Pull Request branch dev-clone to main #1
|
|
@ -29,9 +29,9 @@ export default function AspectFormModal() {
|
|||
const searchParams = routeApi.useSearch();
|
||||
const dataId = searchParams.detail || searchParams.edit;
|
||||
const isDialogOpen = Boolean(dataId || searchParams.create);
|
||||
const formType = searchParams.detail ? "detail" : searchParams.edit ? "edit" : "tambah";
|
||||
const formType = searchParams.detail ? "detail" : searchParams.edit ? "ubah" : "tambah";
|
||||
|
||||
// Fetch aspect data if editing or viewing details
|
||||
// Fetch aspect data if ubahing or viewing details
|
||||
const aspectQuery = useQuery(getAspectByIdQueryOptions(dataId));
|
||||
|
||||
const modalTitle = `${formType.charAt(0).toUpperCase() + formType.slice(1)} Aspek`;
|
||||
|
|
@ -69,10 +69,10 @@ export default function AspectFormModal() {
|
|||
mutationKey: ["aspectMutation"],
|
||||
mutationFn: async (
|
||||
options:
|
||||
| { action: "edit"; data: Parameters<typeof updateAspect>[0] }
|
||||
| { action: "create"; data: Parameters<typeof createAspect>[0] }
|
||||
| { action: "ubah"; data: Parameters<typeof updateAspect>[0] }
|
||||
| { action: "tambah"; data: Parameters<typeof createAspect>[0] }
|
||||
) => {
|
||||
return options.action === "edit"
|
||||
return options.action === "ubah"
|
||||
? await updateAspect(options.data)
|
||||
: await createAspect(options.data);
|
||||
},
|
||||
|
|
@ -134,7 +134,7 @@ export default function AspectFormModal() {
|
|||
: "",
|
||||
};
|
||||
await createAspect(payload);
|
||||
} else if (formType === "edit") {
|
||||
} else if (formType === "ubah") {
|
||||
payload = {
|
||||
id: values.id,
|
||||
name: values.name,
|
||||
|
|
@ -156,7 +156,7 @@ export default function AspectFormModal() {
|
|||
queryClient.invalidateQueries({ queryKey: ["management-aspect"] });
|
||||
|
||||
notifications.show({
|
||||
message: `Aspek ${formType === "tambah" ? "berhasil dibuat" : "berhasil diedit"}`,
|
||||
message: `Aspek ${formType === "tambah" ? "berhasil dibuat" : "berhasil diubah"}`,
|
||||
});
|
||||
|
||||
navigate({ search: {} });
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user