Add Kelola Data
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
SelectValue
|
||||
} from "@/components/ui/select";
|
||||
import { Loader2, Settings } from "lucide-react";
|
||||
import { useToast } from "@/components/ui/toast-provider";
|
||||
|
||||
interface JenisPendaftaran {
|
||||
jenis_pendaftaran: string;
|
||||
@@ -29,7 +30,7 @@ interface EditJenisPendaftaranProps {
|
||||
}
|
||||
|
||||
export default function EditJenisPendaftaran({ onUpdateSuccess }: EditJenisPendaftaranProps) {
|
||||
// Toast hook
|
||||
const { showSuccess, showError } = useToast();
|
||||
|
||||
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
||||
const [jenisPendaftaranList, setJenisPendaftaranList] = useState<JenisPendaftaran[]>([]);
|
||||
@@ -124,7 +125,8 @@ export default function EditJenisPendaftaran({ onUpdateSuccess }: EditJenisPenda
|
||||
await fetchJenisPendaftaran();
|
||||
|
||||
// Show success message
|
||||
|
||||
showSuccess("Berhasil!", "Jenis pendaftaran berhasil diperbarui");
|
||||
|
||||
// Close dialog
|
||||
setIsDialogOpen(false);
|
||||
|
||||
@@ -135,6 +137,7 @@ export default function EditJenisPendaftaran({ onUpdateSuccess }: EditJenisPenda
|
||||
} catch (err) {
|
||||
setError((err as Error).message);
|
||||
console.error("Error updating jenis pendaftaran:", err);
|
||||
showError("Gagal!", (err as Error).message);
|
||||
} finally {
|
||||
setUpdating(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user