Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 토큰 만료 시 리다이렉트 작업, 태그 생성시 길이가 길면 알림 #888

Merged
merged 4 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions frontend/techpick/src/app/(unsigned)/login/failed/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function LoginFailedPage() {
<div className={googleLoginContainer}>
<Link
className={loginLink}
href={`${process.env.NEXT_PUBLIC_API}/login/google?redirectUrl=${redirectUrl}`}
href={`${process.env.NEXT_PUBLIC_API}/login/google?redirect_url=${redirectUrl}`}
>
<Image
style={{ filter: 'brightness(100)' }}
Expand All @@ -54,7 +54,7 @@ export default function LoginFailedPage() {
<div className={kakaoLoginContainer}>
<Link
className={loginLink}
href={`${process.env.NEXT_PUBLIC_API}/login/kakao?redirectUrl=${redirectUrl}`}
href={`${process.env.NEXT_PUBLIC_API}/login/kakao?redirect_url=${redirectUrl}`}
>
<Image
style={{ filter: 'invert(100%)' }}
Expand Down
4 changes: 2 additions & 2 deletions frontend/techpick/src/app/(unsigned)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function LoginPage() {
<div className={googleLoginContainer}>
<Link
className={loginLink}
href={`${process.env.NEXT_PUBLIC_API}/login/google?redirectUrl=${redirectUrl}`}
href={`${process.env.NEXT_PUBLIC_API}/login/google?redirect_url=${redirectUrl}`}
>
<Image
style={{ filter: 'brightness(100)' }}
Expand All @@ -66,7 +66,7 @@ export default function LoginPage() {
<div className={kakaoLoginContainer}>
<Link
className={loginLink}
href={`${process.env.NEXT_PUBLIC_API}/login/kakao?redirectUrl=${redirectUrl}`}
href={`${process.env.NEXT_PUBLIC_API}/login/kakao?redirect_url=${redirectUrl}`}
>
<Image
style={{ filter: 'invert(100%)' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
usePickStore,
useUpdatePickStore,
} from '@/stores';
import { notifyError, numberToRandomColor } from '@/utils';
import { numberToRandomColor } from '@/utils';
import { DeleteTagDialog } from './DeleteTagDialog';
import { DeselectTagButton } from './DeselectTagButton';
import { SelectedTagItem } from '../SelectedTagItem';
Expand Down Expand Up @@ -100,10 +100,8 @@ export function PickTagAutocompleteDialog({
});
randomNumber.current = getRandomInt();
onSelectTag(newTag!);
} catch (error) {
if (error instanceof Error) {
notifyError(error.message);
}
} catch {
/* empty */
} finally {
isCreateFetchPendingRef.current = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import DOMPurify from 'dompurify';
import { EllipsisIcon } from 'lucide-react';
import { useDisclosure } from '@/hooks';
import { useTagStore } from '@/stores';
import { notifyError, isEmptyString, isShallowEqualValue } from '@/utils';
import { isEmptyString, isShallowEqualValue } from '@/utils';
import { ShowDeleteTagDialogButton } from './ShowDeleteTagDialogButton';
import {
tagInfoEditFormLayout,
Expand Down Expand Up @@ -60,10 +60,8 @@ export function TagInfoEditPopoverButton({
name: newTagName,
colorNumber: tag.colorNumber,
});
} catch (error) {
if (error instanceof Error) {
notifyError(error.message);
}
} catch {
/* empty */
}
};

Expand Down
2 changes: 2 additions & 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': '로그인 해주세요.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p4: 백엔드 측에서 JWT 쿠키가 없거나, 변조된 쿠키인 경우 해당 에러 코드를 반환합니다.
로그인 정보가 확인되지 않았습니다. 로그인 후 다시 시도해주세요. 표현은 어떨까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 수정했습니다!

'PK-000': '존재하지 않는 북마크입니다.',
'PK-001': '이미 존재하는 북마크입니다! 북마크 저장을 실패했습니다!',
'PK-002': '접근할 수 없는 북마크입니다.',
Expand All @@ -17,6 +18,7 @@ export const ERROR_MESSAGE_JSON: { [key: string]: string } = {
'TG-001': '중복된 태그가 존재합니다.',
'TG-002': '유효하지 않는 태그 이름입니다.',
'TG-003': '잘못된 태그에 접근했습니다.',
'TG-005': '태그명이 허용된 최대길이를 초과했습니다.',
'LI-000': '존재하지 않는 링크입니다.',
'LI-002': '이미 존재하는 링크입니다.',
'LI-003': '이 링크는 넣을 수 없습니다. ㅠㅠ',
Expand Down
Loading