Skip to content

Commit

Permalink
Merge pull request #160 from Myongji-Graduate/mypage-revalidate-error/#…
Browse files Browse the repository at this point in the history
…158

fix: mypage revalidate error 수정
  • Loading branch information
gahyuun authored Dec 16, 2024
2 parents aa26cb1 + c9f992e commit c2131cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/business/services/lecture/taken-lecture.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { BadRequestError } from '@/app/utils/http/http-error';
import { cookies } from 'next/headers';
import { redirect } from 'next/navigation';
import { instance } from '@/app/utils/api/instance';
import { revalidateTag } from 'next/cache';
import { TAG } from '@/app/utils/http/tag';

export const registerUserGrade = async (prevState: FormState, formData: FormData) => {
const parsingText = await parsePDFtoText(formData);
Expand Down Expand Up @@ -45,7 +47,6 @@ export const deleteTakenLecture = async (lectureId: number) => {
await instance.delete(`${API_PATH.takenLectures}/${lectureId}`, {
responseType: 'text',
});

return {
isSuccess: true,
};
Expand All @@ -69,6 +70,7 @@ export const addTakenLecture = async (lectureId: string) => {
responseType: 'text',
},
);
revalidateTag(TAG.GET_TAKEN_LECTURES);
return {
isSuccess: true,
isFailure: false,
Expand Down
7 changes: 6 additions & 1 deletion app/business/services/lecture/taken-lecture.query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { instance } from '@/app/utils/api/instance';
import { API_PATH } from '../../api-path';
import { TAG } from '@/app/utils/http/tag';

export interface TakenLecturesResponse {
totalCredit: number;
Expand All @@ -17,6 +18,10 @@ export interface TakenLectureInfoResponse {
}

export const fetchTakenLectures = async () => {
const response = await instance.get<TakenLecturesResponse>(API_PATH.takenLectures);
const response = await instance.get<TakenLecturesResponse>(API_PATH.takenLectures, {
next: {
tags: [TAG.GET_TAKEN_LECTURES],
},
});
return response.data;
};
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"express": "^4.18.2",
"fetch-ax": "^1.0.10",
"fetch-ax": "^2.0.3",
"jotai": "^2.7.0",
"lucide-react": "^0.336.0",
"next": "^14.2.13",
Expand Down

0 comments on commit c2131cf

Please sign in to comment.