-
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] 기존의 ErrorBoundary를 react-error-boundary으로 수정
- Loading branch information
Showing
11 changed files
with
165 additions
and
176 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import { CookiesProvider } from "react-cookie"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
import { Outlet } from "react-router-dom"; | ||
import { PhoneNumberProvider } from "@/contexts/phoneNumberContext"; | ||
import { ScrollHeaderStyleProvider } from "@/contexts/scrollHeaderStyleContext.tsx"; | ||
import ErrorElement from "@/pages/ErrorElement"; | ||
import Header from "../Header"; | ||
|
||
export default function Layout() { | ||
return ( | ||
<CookiesProvider> | ||
<ScrollHeaderStyleProvider> | ||
<PhoneNumberProvider> | ||
<Header /> | ||
<Outlet /> | ||
</PhoneNumberProvider> | ||
</ScrollHeaderStyleProvider> | ||
</CookiesProvider> | ||
<ErrorBoundary fallback={<ErrorElement />}> | ||
<CookiesProvider> | ||
<ScrollHeaderStyleProvider> | ||
<PhoneNumberProvider> | ||
<Header /> | ||
<Outlet /> | ||
</PhoneNumberProvider> | ||
</ScrollHeaderStyleProvider> | ||
</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 was deleted.
Oops, something went wrong.
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,19 @@ | ||
import CTAButton from "@/components/CTAButton"; | ||
|
||
interface ErrorElementProps { | ||
fallbackUrl?: string; | ||
} | ||
|
||
export default function ErrorElement({ fallbackUrl = "/" }: ErrorElementProps) { | ||
return ( | ||
<div className="fixed z-10 h-screen w-full bg-n-neutral-950 flex flex-col justify-center items-center"> | ||
<img alt="오류 아이콘" src="/assets/icons/casper-error.svg" /> | ||
<div className="mt-4" /> | ||
<h3 className="h-heading-3-bold text-n-white"> | ||
문제가 발생했습니다. 잠시 후 다시 시도해 보세요. | ||
</h3> | ||
<div className="mt-12" /> | ||
<CTAButton label="돌아가기" url={fallbackUrl} hasArrowIcon /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.