Skip to content

Commit

Permalink
feat: 액세스 토큰 만료되었을 때, 리다이
Browse files Browse the repository at this point in the history
  • Loading branch information
dmdgpdi committed Dec 30, 2024
1 parent 37beb84 commit dc0262e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/techpick/src/apis/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export const apiClient = ky.create({
const parsedErrorMessage = error.message.split(' ');
const errorCode = parsedErrorMessage.shift();

if (!errorCode) {
/* empty */
} else if (ERROR_MESSAGE_JSON[errorCode]) {
notifyError(ERROR_MESSAGE_JSON[errorCode]);
if (errorCode && ERROR_MESSAGE_JSON[errorCode]) {
if (errorCode === 'AU-001') {
window.location.href = '/login';
} else {
notifyError(ERROR_MESSAGE_JSON[errorCode]);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions frontend/techpick/src/constants/errorMessageJson.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const ERROR_MESSAGE_JSON: { [key: string]: string } = {
'AU-001': '로그인 해주세요.',
'PK-000': '존재하지 않는 북마크입니다.',
'PK-001': '이미 존재하는 북마크입니다! 북마크 저장을 실패했습니다!',
'PK-002': '접근할 수 없는 북마크입니다.',
Expand Down

0 comments on commit dc0262e

Please sign in to comment.