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 isModalOpen = Boolean(dataId || searchParams.create);
const detailId = searchParams.detail; const detailId = searchParams.detail;
const editId = searchParams.edit; const editId = searchParams.edit;
const formType = detailId ? "detail" : editId ? "edit" : "create"; const formType = detailId ? "detail" : editId ? "edit" : "tambah";
const form = useForm({ const form = useForm({
initialValues: { initialValues: {
@ -126,7 +126,7 @@ export default function QuestionFormModal() {
// Define possible actions, depending on the action, it can be one or the other // Define possible actions, depending on the action, it can be one or the other
interface MutationOptions { interface MutationOptions {
action: "edit" | "create"; action: "edit" | "tambah";
data: CreateQuestionPayload | UpdateQuestionPayload; data: CreateQuestionPayload | UpdateQuestionPayload;
} }
@ -161,8 +161,8 @@ export default function QuestionFormModal() {
}; };
try { try {
if (formType === "create") { if (formType === "tambah") {
await mutation.mutateAsync({ action: "create", data: payload }); await mutation.mutateAsync({ action: "tambah", data: payload });
notifications.show({ notifications.show({
message: "Data pertanyaan berhasil dibuat!", message: "Data pertanyaan berhasil dibuat!",
color: "green", color: "green",