Pull Request branch dev-clone to main #1

Merged
gitea merged 429 commits from dev-clone into main 2024-12-23 09:31:34 +00:00
Showing only changes of commit 8a7022e37e - Show all commits

View File

@ -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: {} });