updated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
import { CoursesProps, CoursesArrayProps, SettingsProps, MessageProps } from "@/types";
|
||||
import { CoursesProps, CoursesArrayProps, SettingsProps, MessageProps, AboutusProps } from "@/types";
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,30 @@ export async function postMessage(data: MessageProps) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchAboutus() {
|
||||
const headers: HeadersInit = {
|
||||
accept: "application/json"
|
||||
};
|
||||
const url = `${process.env.api_url}aboutUs`;
|
||||
console.log('Fetching from URL:', url);
|
||||
try {
|
||||
const response = await fetch(url, { headers });
|
||||
console.log('Response status:', response.status);
|
||||
const result = await response.json();
|
||||
console.log('Fetched data:', result);
|
||||
|
||||
// Sort the result by index
|
||||
const sortedResult: AboutusProps[] = result.data.sort((a: any, b: any) => a.index - b.index);
|
||||
|
||||
return sortedResult;
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Fetch error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function fetchCourses() {
|
||||
const headers: HeadersInit = {
|
||||
|
Reference in New Issue
Block a user