Pull Request branch dev-clone to main #1
|
|
@ -57,7 +57,7 @@ export default function QuestionFormModal() {
|
|||
const isModalOpen = Boolean(dataId || searchParams.create);
|
||||
const detailId = searchParams.detail;
|
||||
const editId = searchParams.edit;
|
||||
const formType = detailId ? "detail" : editId ? "edit" : "tambah";
|
||||
const formType = detailId ? "detail" : editId ? "ubah" : "tambah";
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
|
|
@ -126,7 +126,7 @@ export default function QuestionFormModal() {
|
|||
|
||||
// Define possible actions, depending on the action, it can be one or the other
|
||||
interface MutationOptions {
|
||||
action: "edit" | "tambah";
|
||||
action: "ubah" | "tambah";
|
||||
data: CreateQuestionPayload | UpdateQuestionPayload;
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ export default function QuestionFormModal() {
|
|||
const mutation = useMutation<MutationResponse, Error, MutationOptions>({
|
||||
mutationKey: ["questionsMutation"],
|
||||
mutationFn: async (options) => {
|
||||
if (options.action === "edit") {
|
||||
if (options.action === "ubah") {
|
||||
return await updateQuestion(options.data as UpdateQuestionPayload);
|
||||
} else {
|
||||
return await createQuestion(options.data as CreateQuestionPayload);
|
||||
|
|
@ -168,7 +168,7 @@ export default function QuestionFormModal() {
|
|||
color: "green",
|
||||
});
|
||||
} else {
|
||||
await mutation.mutateAsync({ action: "edit", data: payload });
|
||||
await mutation.mutateAsync({ action: "ubah", data: payload });
|
||||
notifications.show({
|
||||
message: "Data pertanyaan berhasil diperbarui!",
|
||||
color: "green",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user