CourseForm backend done

This commit is contained in:
Harshitha Shetty
2024-12-09 07:26:57 +05:30
parent e22727eefd
commit ce73a591c5
9 changed files with 408 additions and 76 deletions

View File

@@ -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;
}
};