feat: implement update news functionality with API integration and form handling

This commit is contained in:
Ardeman
2025-03-07 14:40:04 +08:00
parent e0b68611bd
commit d885b3cf26
5 changed files with 105 additions and 6 deletions
+1 -4
View File
@@ -21,12 +21,9 @@ export const createNewsRequest = async (parameters: TParameter) => {
const transformedPayload = {
...restPayload,
categories: categories.map((category) => category?.id),
tags: tags?.map((tag) => tag?.id),
tags: tags?.map((tag) => tag?.id) || [],
live_at: new Date(payload?.live_at).toISOString(),
}
if (transformedPayload.tags?.length === 0) {
delete transformedPayload.tags
}
const { data } = await HttpServer({ accessToken }).post(
'/api/news/create',
transformedPayload,