-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a86c936
commit 4353a4e
Showing
12 changed files
with
28 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
/* eslint-disable no-console */ | ||
"use client"; | ||
|
||
import { Button } from "@nextui-org/button"; | ||
import { Card } from "@nextui-org/card"; | ||
import { useEffect } from "react"; | ||
import { toast } from "react-toastify"; | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
export default function Error({ error, reset }: { | ||
error: Error & { digest?: string } | ||
reset: () => void | ||
}) { | ||
useEffect(() => { | ||
/* eslint-disable no-console */ | ||
console.error(error); | ||
}, [error]); | ||
useEffect(() => { | ||
console.error(error); | ||
toast.error("页面出错"); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<h2>Something went wrong!</h2> | ||
<button onClick={() => reset()}>Try again</button> | ||
</div> | ||
); | ||
return ( | ||
<div className="w-[100vw] h-[100vh] flex justify-center items-center"> | ||
<Card className="w-[30rem] h-fit p-6 flex flex-col gap-5"> | ||
<div className="flex-1"> | ||
<h1 className="text-2xl font-bold mb-3">Ferrum 错误</h1> | ||
|
||
<p className="break-words"> | ||
<code>{error.message}</code> | ||
</p> | ||
{error.digest && <p className="text-red-700 float-right">(digest: {error.digest})</p>} | ||
</div> | ||
|
||
<Button color="primary" onPress={() => reset()}>重试</Button> | ||
</Card> | ||
</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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
"use client"; | ||
|
||
import type { ViewItemProps } from "@/types"; | ||
|
||
import React from "react"; | ||
|
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,5 +1,3 @@ | ||
"use client"; | ||
|
||
import type { ViewProps } from "@/types"; | ||
|
||
import React from "react"; | ||
|
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,5 +1,3 @@ | ||
"use client"; | ||
|
||
import type { ViewItemProps } from "@/types"; | ||
|
||
import React from "react"; | ||
|
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,5 +1,3 @@ | ||
"use client"; | ||
|
||
import type { ViewProps } from "@/types"; | ||
|
||
import React from "react"; | ||
|
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,5 +1,3 @@ | ||
"use client"; | ||
|
||
import path from "path"; | ||
|
||
import React from "react"; | ||
|
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,5 +1,3 @@ | ||
"use client"; | ||
|
||
import React, { type PropsWithChildren } from "react"; | ||
import { Card } from "@nextui-org/card"; | ||
|
||
|