-
Notifications
You must be signed in to change notification settings - Fork 2
[Feat/#309]에러 처리와 약관 동의 #313
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0e7a613
feat: implement error handling and terms agreement modal
seohyun06 709450c
fix: handle login failure locally instead of triggering global error
seohyun06 270c742
Merge branch 'develop' of https://github.com/FESI-FlowIt/Frontend int…
seohyun06 ce8752f
style: center client/server error pages and change background to them…
seohyun06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
| 'use client'; | ||
|
|
||
| import { useEffect, useMemo } from 'react'; | ||
|
|
||
| import { useRouter } from 'next/navigation'; | ||
|
|
||
| import ErrorFallback from '@/components/ui/ErrorFallback'; | ||
|
|
||
| export default function GlobalError({ | ||
| error, | ||
| reset, | ||
| }: { | ||
| error: Error & { digest?: string }; | ||
| reset: () => void; | ||
| }) { | ||
| const router = useRouter(); | ||
|
|
||
| const target = useMemo(() => { | ||
| const code = (error as any)?.statusCode ?? (error as any)?.status; | ||
| if (typeof code !== 'number') return null; | ||
| if (code >= 500 && code < 600) return '/error/500error'; | ||
| if (code >= 400 && code < 500) return '/error/400error'; | ||
| return null; | ||
| }, [error]); | ||
|
|
||
| useEffect(() => { | ||
| if (target) router.replace(target); | ||
| }, [target, router]); | ||
|
|
||
| return ( | ||
| <html suppressHydrationWarning> | ||
| <body className="bg-muted/30 flex min-h-dvh items-center justify-center"> | ||
| {target ? null : ( | ||
| <ErrorFallback | ||
| type="general" | ||
| title="문제가 발생했어요" | ||
| subTitle="잠시 후 다시 시도해 주세요." | ||
| primaryLabel="다시 시도" | ||
| onRetry={reset} | ||
| secondaryLabel="홈으로" | ||
| onNavigate={() => router.push('/')} | ||
| /> | ||
| )} | ||
| </body> | ||
| </html> | ||
| ); | ||
| } |
This file contains hidden or 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,18 @@ | ||
| 'use client'; | ||
| import ErrorFallback from '@/components/ui/ErrorFallback'; | ||
|
|
||
| export default function ClientErrorPage() { | ||
| return ( | ||
| <div className="bg-background flex h-screen w-screen items-center justify-center"> | ||
| <ErrorFallback | ||
| type="notFound" | ||
| title="페이지를 찾을 수 없어요" | ||
| subTitle="요청하신 페이지가 존재하지 않습니다" | ||
| primaryLabel="홈으로" | ||
| secondaryLabel="이전 페이지" | ||
| onNavigate={() => (window.location.href = '/')} | ||
| navigateHref="/" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,18 @@ | ||
| 'use client'; | ||
| import ErrorFallback from '@/components/ui/ErrorFallback'; | ||
|
|
||
| export default function ServerErrorPage() { | ||
| return ( | ||
| <div className="bg-background flex h-screen w-screen items-center justify-center"> | ||
| <ErrorFallback | ||
| type="general" | ||
| title="문제가 발생했어요" | ||
| subTitle="잠시 후 다시 시도해 주세요" | ||
| primaryLabel="다시 시도" | ||
| secondaryLabel="홈으로" | ||
| onNavigate={() => (window.location.href = '/')} | ||
| navigateHref="/" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,34 @@ | ||
| 'use client'; | ||
| import React from 'react'; | ||
|
|
||
| export default class RQErrorBoundary extends React.Component< | ||
| { children: React.ReactNode }, | ||
| { hasError: boolean } | ||
| > { | ||
| constructor(props: any) { | ||
| super(props); | ||
| this.state = { hasError: false }; | ||
| } | ||
|
|
||
| static getDerivedStateFromError() { | ||
| return { hasError: true }; | ||
| } | ||
|
|
||
| componentDidCatch(error: any) { | ||
| const status = error?.statusCode ?? error?.status ?? error?.response?.status; | ||
|
|
||
| if (typeof status === 'number') { | ||
| if (status >= 500) { | ||
| window.location.replace('/error/500error'); | ||
| } else if (status >= 400) { | ||
| window.location.replace('/error/400error'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| render() { | ||
| if (this.state.hasError) return null; | ||
|
|
||
| return this.props.children; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.