refactor: update Test component to simplify button actions and integrate toast notifications
This commit is contained in:
parent
6d69e6c037
commit
8c802dcabf
2 changed files with 8 additions and 27 deletions
|
|
@ -72,7 +72,11 @@ const MyApp = ({
|
||||||
}
|
}
|
||||||
`}</style>
|
`}</style>
|
||||||
|
|
||||||
<Toaster position="top-right" reverseOrder={false} />
|
<Toaster
|
||||||
|
containerClassName="mt-10"
|
||||||
|
position="top-right"
|
||||||
|
reverseOrder={false}
|
||||||
|
/>
|
||||||
{!router.pathname.startsWith("/annunci") && (
|
{!router.pathname.startsWith("/annunci") && (
|
||||||
<NextNProgress options={{ showSpinner: false }} />
|
<NextNProgress options={{ showSpinner: false }} />
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,12 @@
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import { api } from "~/utils/api";
|
|
||||||
|
|
||||||
const Test: NextPage = () => {
|
const Test: NextPage = () => {
|
||||||
const { mutate } = api.test.testErr.useMutation();
|
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-4 p-4">
|
<div className="flex gap-4 p-4">
|
||||||
<Button onClick={() => console.log("test console.log")} type="button">
|
<Button onClick={() => toast.success("asdasdasdasdasda")} type="button">
|
||||||
test console.log
|
test
|
||||||
</Button>
|
|
||||||
<Button onClick={() => console.info("test console.info")} type="button">
|
|
||||||
test console.info
|
|
||||||
</Button>
|
|
||||||
<Button onClick={() => console.error("test console.error")} type="button">
|
|
||||||
test console.error
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
throw new Error("test Error");
|
|
||||||
}}
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
test Error
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
mutate();
|
|
||||||
}}
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
Server
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue