File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { style } from "@vanilla-extract/css" ;
2+ import { themeVars } from "@/shared/styles/base/theme.css" ;
3+
4+ export const container = style ( {
5+ display : "flex" ,
6+ flexDirection : "column" ,
7+ justifyContent : "center" ,
8+ alignItems : "center" ,
9+ width : "100%" ,
10+ height : "100%" ,
11+ } ) ;
12+
13+ export const title = style ( {
14+ ...themeVars . text . F17 ,
15+ color : themeVars . color . white [ 100 ] ,
16+ marginTop : "2rem" ,
17+ marginBottom : "0.6rem" ,
18+ } ) ;
19+
20+ export const description = style ( {
21+ ...themeVars . text . F16 ,
22+ color : themeVars . color . white [ 40 ] ,
23+ } ) ;
24+
25+ export const button = style ( {
26+ marginTop : "1.6rem" ,
27+ ...themeVars . text . F14 ,
28+ color : themeVars . color . black [ 100 ] ,
29+ backgroundColor : themeVars . color . white [ 100 ] ,
30+ borderRadius : "8px" ,
31+ padding : "0.8rem 1.2rem" ,
32+ selectors : {
33+ "&:hover" : {
34+ backgroundColor : themeVars . color . white [ 70 ] ,
35+ } ,
36+ } ,
37+ } ) ;
Original file line number Diff line number Diff line change 1+ 'use client'
2+ import NoneImage from "@/shared/assets/2D-illust/none.svg" ;
3+ import * as styles from "./not-found.css" ;
4+
5+ import { PATH } from "@/shared/constants/path" ;
6+ import { useRouter } from "next/navigation" ;
7+
8+ export default function NotFound ( ) {
9+ const router = useRouter ( ) ;
10+
11+ return (
12+ < div className = { styles . container } >
13+ < NoneImage width = { 120 } height = { 65 } />
14+ < p className = { styles . title } > 페이지를 찾을 수 없습니다.</ p >
15+ < p className = { styles . description } >
16+ 찾으시는 페이지가 존재하지 않거나 </ p >
17+ < p className = { styles . description } > 이동되었을 수 있습니다.</ p >
18+ < button
19+ onClick = { ( ) => router . push ( PATH . HOME ) }
20+ className = { styles . button }
21+ >
22+ 홈으로 돌아가기
23+ </ button >
24+ </ div >
25+ ) ;
26+ }
Original file line number Diff line number Diff line change 11import ky , { type Options as KyOptions , type ResponsePromise } from "ky" ;
2+ import { HTTP_STATUS_CODE } from "@/shared/constants/api" ;
3+ import { HTTPError } from "ky" ;
4+ import { PATH } from "@/shared/constants/path" ;
25
36const API_BASE_URL =
47 process . env . NODE_ENV === "development"
@@ -13,6 +16,26 @@ const http = ky.create({
1316 "Content-Type" : "application/json" ,
1417 } ,
1518 credentials : "include" ,
19+ hooks : {
20+ beforeError : [
21+ async ( error ) => {
22+ if ( error instanceof HTTPError ) {
23+ const { response } = error ;
24+ switch ( response . status ) {
25+ case HTTP_STATUS_CODE . UNAUTHORIZED : {
26+ window . location . replace ( PATH . LOGIN ) ;
27+ break ;
28+ }
29+ case HTTP_STATUS_CODE . NOT_FOUND : {
30+ window . location . replace ( "/404" ) ;
31+ break ;
32+ }
33+ }
34+ }
35+ return error ;
36+ } ,
37+ ] ,
38+ } ,
1639} ) ;
1740
1841async function parseResponse < T > ( res : ResponsePromise ) : Promise < T > {
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export const useLeaveCapsule = () => {
5151 } ) ,
5252 queryClient . invalidateQueries ( { queryKey : capsuleQueryKeys . lists ( ) } ) ,
5353 queryClient . invalidateQueries ( { queryKey : capsuleQueryKeys . my ( ) } ) ,
54+ queryClient . invalidateQueries ( { queryKey : capsuleQueryKeys . all ( ) } ) ,
5455 ] ) ;
5556 } ,
5657 } ) ;
Original file line number Diff line number Diff line change 1+ export const HTTP_STATUS_CODE = {
2+ SUCCESS : 200 ,
3+ CREATED : 201 ,
4+ BAD_REQUEST : 400 ,
5+ UNAUTHORIZED : 401 ,
6+ NOT_FOUND : 404 ,
7+ CONFLICT : 409 ,
8+ INTERNAL_SERVER_ERROR : 500 ,
9+ } as const ;
Original file line number Diff line number Diff line change @@ -17,9 +17,7 @@ export const ENDPOINTS = {
1717 `api/v1/capsules/search?keyword=${ encodeURIComponent ( keyword ) } &page=${ page } &size=${ size } ` ,
1818
1919 LEAVE_CAPSULE : ( id : string ) => `api/v1/capsules/${ id } /leave` ,
20-
2120 LIKE_TOGGLE : ( id : string ) => `api/v1/capsules/${ id } /like` ,
22-
2321 MY_CAPSULE_LIST : (
2422 page = 0 ,
2523 size = 20 ,
You can’t perform that action at this time.
0 commit comments