File tree Expand file tree Collapse file tree
apps/ticket/src/shared/components/AuthErrorFallback Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,16 +9,27 @@ export const AuthErrorFallback = () => {
99
1010 useEffect ( ( ) => {
1111 const tokenReissue = async ( ) => {
12- const res = await fetch ( "/api/reissue" , {
13- method : "POST" ,
14- headers : {
15- "Content-Type" : "application/json" ,
16- } ,
17- credentials : "include" ,
18- } ) ;
19-
20- // 토큰 재발급 후 reload()
21- window . location . reload ( ) ;
12+ try {
13+ const res = await fetch ( "/api/reissue" , {
14+ method : "POST" ,
15+ headers : {
16+ "Content-Type" : "application/json" ,
17+ } ,
18+ credentials : "include" ,
19+ } ) ;
20+
21+ if ( res . ok ) {
22+ // 토큰 재발급 성공 → 새로고침
23+ window . location . reload ( ) ;
24+ } else {
25+ // 재발급 실패 → 로그인
26+ window . location . href = "/login" ;
27+ }
28+ } catch ( error ) {
29+ console . error ( "토큰 재발급 실패:" , error ) ;
30+ alert ( "인증 오류가 발생했습니다. 다시 로그인해주세요." ) ;
31+ window . location . href = "/login" ;
32+ }
2233 } ;
2334
2435 tokenReissue ( ) ;
You can’t perform that action at this time.
0 commit comments