update: language adjustment on edit modal in question management

This commit is contained in:
falendikategar 2024-11-21 13:35:25 +07:00
parent 8a7022e37e
commit 7d8fa7bfc0

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" : "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",