CourseForm backend done
This commit is contained in:
@@ -26,3 +26,30 @@ export const fetchCourses = async (filterData) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchFaculties = async () => {
|
||||
try {
|
||||
const response = await fetch(`${BASE_URL}/faculty`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch faculties: ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching faculties:", error.message);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchOptions = async () => {
|
||||
try {
|
||||
const response = await fetch(`${BASE_URL}/options`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch options: ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching options:", error.message);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user