update: language adjustment on edit modal in question management
This commit is contained in:
parent
8a7022e37e
commit
7d8fa7bfc0
|
|
@ -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" : "tambah";
|
const formType = detailId ? "detail" : editId ? "ubah" : "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" | "tambah";
|
action: "ubah" | "tambah";
|
||||||
data: CreateQuestionPayload | UpdateQuestionPayload;
|
data: CreateQuestionPayload | UpdateQuestionPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ export default function QuestionFormModal() {
|
||||||
const mutation = useMutation<MutationResponse, Error, MutationOptions>({
|
const mutation = useMutation<MutationResponse, Error, MutationOptions>({
|
||||||
mutationKey: ["questionsMutation"],
|
mutationKey: ["questionsMutation"],
|
||||||
mutationFn: async (options) => {
|
mutationFn: async (options) => {
|
||||||
if (options.action === "edit") {
|
if (options.action === "ubah") {
|
||||||
return await updateQuestion(options.data as UpdateQuestionPayload);
|
return await updateQuestion(options.data as UpdateQuestionPayload);
|
||||||
} else {
|
} else {
|
||||||
return await createQuestion(options.data as CreateQuestionPayload);
|
return await createQuestion(options.data as CreateQuestionPayload);
|
||||||
|
|
@ -168,7 +168,7 @@ export default function QuestionFormModal() {
|
||||||
color: "green",
|
color: "green",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await mutation.mutateAsync({ action: "edit", data: payload });
|
await mutation.mutateAsync({ action: "ubah", data: payload });
|
||||||
notifications.show({
|
notifications.show({
|
||||||
message: "Data pertanyaan berhasil diperbarui!",
|
message: "Data pertanyaan berhasil diperbarui!",
|
||||||
color: "green",
|
color: "green",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user