refactor(marketing): Standardize marketing wizard steps with initial data support
- Add support for initial data in all marketing wizard step components - Update step presenters to accept and handle initial data - Modify forwardRef implementations to include initialData prop - Add TypeScript interfaces for step component props - Improve type safety and data handling across marketing wizard steps - Prepare components for edit and create workflows with consistent data management
This commit is contained in:
@@ -56,3 +56,25 @@ export const useDeleteCms = (successCallback?: () => void) => {
|
||||
},
|
||||
});
|
||||
};
|
||||
export const useUpdateCms = (id: string) => {
|
||||
const router = useRouter();
|
||||
const queryClient = useQueryClient();
|
||||
const mutationKey = useMemo(
|
||||
() => [API_ENDPOINTS.CMS.BASE(id), "Update cms"],
|
||||
[id],
|
||||
);
|
||||
return useMutation({
|
||||
mutationKey,
|
||||
mutationFn: (data: any) => cmsService.updateCms({ id, data }),
|
||||
onSuccess: () => {
|
||||
toast.success("CMS updated successfully");
|
||||
router.push("/marketing");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [API_ENDPOINTS.CMS.BASE()],
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [API_ENDPOINTS.CMS.BASE(id)],
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user