Pull Request branch dev-clone to main #1

Merged
gitea merged 429 commits from dev-clone into main 2024-12-23 09:31:34 +00:00
Showing only changes of commit 7d8fa7bfc0 - Show all commits

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