bd79b7ed14
- 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
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import api from "../axios";
|
|
import { API_ENDPOINTS } from "../endpoints";
|
|
import { ApiResponse } from "../types";
|
|
import { TCms, TCmsListResponse } from "../types/TCms";
|
|
|
|
export const cmsService = {
|
|
getCms: async (): Promise<ApiResponse<TCmsListResponse>> => {
|
|
try {
|
|
return (await api.get(API_ENDPOINTS.CMS.BASE())).data;
|
|
} catch (error) {
|
|
console.error("Error Caught in CMS Service => Get cms", error);
|
|
throw error;
|
|
}
|
|
},
|
|
createCms: async (data: any) => {
|
|
try {
|
|
return (await api.post(API_ENDPOINTS.CMS.BASE(), data)).data;
|
|
} catch (error) {
|
|
console.error("Error Caught in CMS Service => Create cms", error);
|
|
throw error;
|
|
}
|
|
},
|
|
getCmsDetails: async (id: string) => {
|
|
try {
|
|
return (await api.get(API_ENDPOINTS.CMS.BASE(id))).data;
|
|
} catch (error) {
|
|
console.error("Error Caught In CMS Service => getCmsDetails: ", error);
|
|
throw error;
|
|
}
|
|
},
|
|
deleteCms: async (id: string) => {
|
|
try {
|
|
return (await api.delete(API_ENDPOINTS.CMS.BASE(id))).data;
|
|
} catch (error) {
|
|
console.error("Error caught in CMS Service => delete CMS: ", error);
|
|
throw error;
|
|
}
|
|
},
|
|
updateCms: async ({
|
|
id,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
}): Promise<{ data: TCms; message: string }> => {
|
|
try {
|
|
return (await api.put(API_ENDPOINTS.CMS.BASE(id), data)).data;
|
|
} catch (error) {
|
|
console.error("Error Caught in CMS Service => Update cms", error);
|
|
throw error;
|
|
}
|
|
},
|
|
};
|