-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 드롭다운 색상 수정 * fix: 인증 관련 오류 수정 * fix: 글로벌 에러바운더리 추가 * chore: 주석 코드 리버트
- Loading branch information
Showing
14 changed files
with
93 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
apps/admin/src/components/ErrorBoundary/GlobalErrorBoundary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { isBooltiHTTPError } from '@boolti/api/src/BooltiHTTPError'; | ||
import { useEffect } from 'react'; | ||
import { Navigate, useRouteError } from 'react-router-dom'; | ||
import { PATH } from '~/constants/routes'; | ||
|
||
const GlobalErrorBoundary = () => { | ||
const error = useRouteError(); | ||
|
||
useEffect(() => { | ||
if (error instanceof Error && isBooltiHTTPError(error)) { | ||
const errorMessage = '[BooltiHTTPError] errorTraceId:' + error.errorTraceId + '\n'; | ||
'[BooltiHTTPError] type' + error.type + '\n'; | ||
'[BooltiHTTPError] detail' + error.detail; | ||
console.error(errorMessage); | ||
return; | ||
} | ||
console.error(error); | ||
}); | ||
|
||
return <Navigate to={PATH.INDEX} replace />; | ||
}; | ||
|
||
export default GlobalErrorBoundary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
import type { UseMutationOptions } from '@tanstack/react-query'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import { LOCAL_STORAGE } from '../constants'; | ||
import { fetcher } from '../fetcher'; | ||
|
||
const postLogout = () => fetcher.post('web/v1/logout'); | ||
|
||
const useLogout = (options?: UseMutationOptions) => | ||
useMutation(postLogout, { | ||
...options, | ||
onSuccess: (data, variables, context) => { | ||
if (options?.onSuccess) { | ||
options.onSuccess(data, variables, context); | ||
} else { | ||
window.localStorage.removeItem(LOCAL_STORAGE.ACCESS_TOKEN); | ||
window.localStorage.removeItem(LOCAL_STORAGE.REFRESH_TOKEN); | ||
} | ||
}, | ||
}); | ||
const useLogout = () => { | ||
return useMutation({ mutationFn: postLogout }); | ||
}; | ||
|
||
export default useLogout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters