added organ
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
import { CoursesProps, CoursesArrayProps, SettingsProps, MessageProps, AboutusProps } from "@/types";
|
||||
import { CoursesProps, CoursesArrayProps, SettingsProps, MessageProps, AboutusProps, OrganProps } from "@/types";
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,28 @@ export async function postMessage(data: MessageProps) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchOrgan() {
|
||||
const headers: HeadersInit = {
|
||||
accept: "application/json"
|
||||
};
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}organ/`;
|
||||
|
||||
try {
|
||||
const response = await fetch(url, { headers });
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
// Sort the result by index
|
||||
const sortedResult: OrganProps[] = 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 fetchAboutus() {
|
||||
const headers: HeadersInit = {
|
||||
accept: "application/json"
|
||||
|
Reference in New Issue
Block a user