feat: add start_date and end_date fields to advertisements with transformation and display in forms
This commit is contained in:
@@ -15,10 +15,15 @@ type TParameters = {
|
||||
|
||||
export const createAdsRequest = async (parameters: TParameters) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
const transformedPayload = {
|
||||
...payload,
|
||||
start_date: new Date(payload.start_date).toISOString(),
|
||||
end_date: new Date(payload.end_date).toISOString(),
|
||||
}
|
||||
try {
|
||||
const { data } = await HttpServer(restParameters).post(
|
||||
'/api/ads/create',
|
||||
payload,
|
||||
transformedPayload,
|
||||
)
|
||||
return advertisementsResponseSchema.parse(data)
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user