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:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user