diff --git a/utils/index.ts b/utils/index.ts index 147e6d6..f540be1 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -42,12 +42,12 @@ export async function fetchAboutus() { accept: "application/json" }; const url = `${process.env.NEXT_PUBLIC_API_URL}aboutUs/`; - + try { const response = await fetch(url, { headers }); - + const result = await response.json(); - + // Sort the result by index const sortedResult: AboutusProps[] = result.data.sort((a: any, b: any) => a.index - b.index); @@ -71,10 +71,10 @@ export async function fetchCourses() { try { const response = await fetch(url, { headers }); - + const result = await response.json(); - + const coursesArray: CoursesProps[] = result.data.map((course: CoursesProps) => ({ ...course, @@ -88,7 +88,7 @@ export async function fetchCourses() { return sortedCoursesArray; } catch (error) { - + throw error; } } @@ -99,14 +99,14 @@ export async function fetchCourse(id: string) { }; const url = `${process.env.NEXT_PUBLIC_API_URL}course/${id}/`; - + try { const response = await fetch(url, { headers }); - + var result: CoursesProps = await response.json(); - + if (result.info_images && Array.isArray(result.info_images)) { result.info_images.sort((a, b) => a.index - b.index); @@ -121,15 +121,16 @@ export async function fetchCourse(id: string) { export async function fetchSettings() { const headers: HeadersInit = { - accept: "application/json" + accept: "application/json", + cache: 'no-store' }; const url = `${process.env.NEXT_PUBLIC_API_URL}setting/`; - + try { const response = await fetch(url, { headers }); - + const result: SettingsProps = await response.json(); - + return result; } catch (error) {