Skip to content

Commit

Permalink
fix: 상세페이지 Id가 존재하지 않는 주류인 경우 404페이지로 리다이렉트 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhpark42 authored Oct 28, 2021
1 parent 56a72ba commit 909aad1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/constants/applicationErrorCode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const APPLICATION_ERROR_CODE = {
NETWORK_ERROR: 444,
INTERNAL_SERVER_ERROR: 500,

NON_EXISTENCE_DRINK: 2003,
};

export default APPLICATION_ERROR_CODE;
6 changes: 5 additions & 1 deletion frontend/src/pages/DrinksDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ const DrinksDetailPage = () => {
});
}

if (Number(error.code) === APPLICATION_ERROR_CODE.NON_EXISTENCE_DRINK) {
return history.push(PATH.NON_EXISTENCE_PAGE);
}

setSnackbarMessage?.({
type: 'ERROR',
message: ERROR_MESSAGE[error.code] ?? ERROR_MESSAGE.DEFAULT,
Expand Down Expand Up @@ -244,7 +248,7 @@ const DrinksDetailPage = () => {
) : (
<ImageWrapper>
<Image
src={imageResponse.medium}
src={imageResponse?.medium}
alt={name}
loading="lazy"
onMouseDown={onImageSizeIncrease}
Expand Down

0 comments on commit 909aad1

Please sign in to comment.