Skip to content

Commit

Permalink
refactor(frontend): remove unless fetch key
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodds committed Feb 1, 2024
1 parent 67c7b51 commit 47ec91c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
33 changes: 0 additions & 33 deletions apps/frontend/composables/useCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,36 +72,3 @@ export const useCache = async (): Promise<AppCache> => {
}
throw new Error("This should never happen.");
};

// export const useCache = async (): Promise<AppCache> => {
// const config = useRuntimeConfig();
// const [{ data: courses }, { data: colleges }, { data: departments }] =
// await Promise.all([
// $fetch<APIResponse<APICourse[]>>(`${config.public.apiBaseUrl}/courses`),
// $fetch<APIResponse<APICollege[]>>(`${config.public.apiBaseUrl}/colleges`),
// $fetch<APIResponse<APIDepartment[]>>(
// `${config.public.apiBaseUrl}/departments`,
// ),
// ]);
// if (!courses)
// throw createError({
// statusCode: 503,
// message:
// "Course data is not available, please contact the website owner.",
// });
// if (!colleges)
// throw createError({
// statusCode: 503,
// message:
// "College data is not available, please contact the website owner.",
// });
// if (!departments)
// throw createError({
// statusCode: 503,
// message:
// "Departments data is not available, please contact the website owner.",
// });
// const t1 = new Colleges(colleges);
// const t2 = new Departments(departments);
// return new AppCache(new Courses(courses, t1, t2), t1, t2);
// };
9 changes: 3 additions & 6 deletions apps/frontend/pages/courses/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,11 @@ if (!t)
statusMessage: `Page Not Found: ${route.path}`,
});
const course = ref(t);
const { data: courseFeedbackRes } = await useFetch<
APIResponse<APICourseFeedback>
>(
const courseFeedbackUrl = computed(
() => `${config.public.apiBaseUrl}/course-feedbacks/${course.value.classNo}`,
{
key: `${config.public.apiBaseUrl}/course-feedbacks/${course.value.classNo}`,
},
);
const { data: courseFeedbackRes } =
await useFetch<APIResponse<APICourseFeedback>>(courseFeedbackUrl);
if (!courseFeedbackRes.value || !courseFeedbackRes.value.data)
throw createError({
statusCode: 503,
Expand Down

0 comments on commit 47ec91c

Please sign in to comment.