update: question form modal title

This commit is contained in:
abiyasa05 2024-11-21 13:26:51 +07:00
parent 9a1e98325e
commit 4aa10b3125

View File

@ -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" : "create";
const formType = detailId ? "detail" : editId ? "edit" : "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" | "create";
action: "edit" | "tambah";
data: CreateQuestionPayload | UpdateQuestionPayload;
}
@ -161,8 +161,8 @@ export default function QuestionFormModal() {
};
try {
if (formType === "create") {
await mutation.mutateAsync({ action: "create", data: payload });
if (formType === "tambah") {
await mutation.mutateAsync({ action: "tambah", data: payload });
notifications.show({
message: "Data pertanyaan berhasil dibuat!",
color: "green",