fix: Dialog not closing after successful page creation

- Fixed response handling in mutationFn
- api.post() returns JSON directly, not wrapped in { data: ... }
- Return response instead of response.data
This commit is contained in:
Dwindi Ramadhana
2026-01-11 23:34:10 +07:00
parent e66f5e54a1
commit 75cd338c60

View File

@@ -52,8 +52,9 @@ export function CreatePageModal({ open, onOpenChange, onCreated }: CreatePageMod
isSubmittingRef.current = true;
try {
// api.post returns JSON directly (not wrapped in { data: ... })
const response = await api.post('/pages', { title: data.title, slug: data.slug });
return response.data;
return response; // Return response directly, not response.data
} finally {
// Reset after a delay to prevent race conditions
setTimeout(() => {