feat: add start_date and end_date fields to advertisements with transformation and display in forms

This commit is contained in:
Ardeman
2025-03-14 12:47:43 +08:00
parent 273add293e
commit f04ad1a8f8
6 changed files with 150 additions and 2 deletions
+6 -1
View File
@@ -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) {