toast für admin-formulare
This commit is contained in:
@@ -9,6 +9,7 @@ import { useState } from "react";
|
||||
import { deleteStation, upsertStation } from "../action";
|
||||
import { Button } from "../../../../_components/ui/Button";
|
||||
import { redirect } from "next/navigation";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export const StationForm = ({ station }: { station?: Station }) => {
|
||||
const form = useForm({
|
||||
@@ -24,6 +25,7 @@ export const StationForm = ({ station }: { station?: Station }) => {
|
||||
setLoading(true);
|
||||
await upsertStation(values, station?.id);
|
||||
setLoading(false);
|
||||
toast.success("Daten gespeichert");
|
||||
if (!station) redirect(`/admin/station`);
|
||||
})}
|
||||
className="grid grid-cols-6 gap-3"
|
||||
|
||||
Reference in New Issue
Block a user