-
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.
Browse files
Browse the repository at this point in the history
[Feat] 어드민 - Error handling 구현
- Loading branch information
Showing
9 changed files
with
73 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import { CookiesProvider } from "react-cookie"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
import { Outlet } from "react-router-dom"; | ||
import ErrorElement from "@/pages/ErrorElement"; | ||
import Header from "../Header"; | ||
|
||
export default function Layout() { | ||
return ( | ||
<div className="overflow-hidden h-screen"> | ||
<Header /> | ||
<div className="mb-[80px]"> | ||
<Outlet /> | ||
</div> | ||
</div> | ||
<ErrorBoundary fallback={<ErrorElement />}> | ||
<CookiesProvider> | ||
<div className="overflow-hidden h-screen"> | ||
<Header /> | ||
<div className="mb-[80px]"> | ||
<Outlet /> | ||
</div> | ||
</div> | ||
</CookiesProvider> | ||
</ErrorBoundary> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Button from "@/components/Button"; | ||
|
||
interface ErrorElementProps { | ||
fallbackUrl?: string; | ||
} | ||
|
||
export default function ErrorElement({ fallbackUrl = "/" }: ErrorElementProps) { | ||
const handleClickButton = () => { | ||
window.location.href = fallbackUrl; | ||
}; | ||
|
||
return ( | ||
<div className="fixed z-10 h-screen w-full bg-n-neutral-950 flex flex-col justify-center items-center"> | ||
<h3 className="h-heading-3-bold text-n-white"> | ||
문제가 발생했습니다. 잠시 후 다시 시도해 보세요. | ||
</h3> | ||
<div className="mt-12" /> | ||
<Button buttonSize="lg" onClick={handleClickButton}> | ||
돌아가기 | ||
</Button> | ||
</div> | ||
); | ||
} |
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,5 @@ | ||
import { Navigate } from "react-router-dom"; | ||
|
||
export default function NotFound() { | ||
return <Navigate to="/" replace />; | ||
} |
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