depoly
This commit is contained in:
@@ -11,7 +11,7 @@ export async function postMessage(data: MessageProps) {
|
||||
};
|
||||
|
||||
const body = JSON.stringify(data);
|
||||
const url = `http://localhost/api/v1/messages/`;
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}messages/`;
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
@@ -41,7 +41,7 @@ export async function fetchAboutus() {
|
||||
const headers: HeadersInit = {
|
||||
accept: "application/json"
|
||||
};
|
||||
const url = `${process.env.api_url}aboutUs`;
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}aboutUs/`;
|
||||
console.log('Fetching from URL:', url);
|
||||
try {
|
||||
const response = await fetch(url, { headers });
|
||||
@@ -67,7 +67,7 @@ export async function fetchCourses() {
|
||||
accept: "application/json"
|
||||
};
|
||||
|
||||
const url = `${process.env.api_url}course/?skip=0&limit=100`;
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}course/?skip=0&limit=100`;
|
||||
console.log('Fetching from URL:', url);
|
||||
|
||||
try {
|
||||
@@ -83,7 +83,11 @@ export async function fetchCourses() {
|
||||
info_images: course?.info_images?.sort((a: any, b: any) => a.index - b.index),
|
||||
}));
|
||||
|
||||
return coursesArray;
|
||||
const sortedCoursesArray = coursesArray.sort((a, b) =>
|
||||
new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
||||
);
|
||||
|
||||
return sortedCoursesArray;
|
||||
} catch (error) {
|
||||
console.error('Fetch error:', error);
|
||||
throw error;
|
||||
@@ -95,7 +99,7 @@ export async function fetchCourse(id: string) {
|
||||
accept: "application/json"
|
||||
};
|
||||
|
||||
const url = `${process.env.api_url}course/${id}`;
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}course/${id}/`;
|
||||
console.log('Fetching from URL:', url);
|
||||
|
||||
try {
|
||||
@@ -120,7 +124,7 @@ export async function fetchSettings() {
|
||||
const headers: HeadersInit = {
|
||||
accept: "application/json"
|
||||
};
|
||||
const url = `${process.env.api_url}setting`;
|
||||
const url = `${process.env.NEXT_PUBLIC_API_URL}setting/`;
|
||||
console.log('Fetching from URL:', url);
|
||||
try {
|
||||
const response = await fetch(url, { headers });
|
||||
|
Reference in New Issue
Block a user