fix:edit article

This commit is contained in:
Rama Priyanto 2025-04-11 15:36:51 +07:00
parent bca3031c61
commit 4be33b9111
1 changed files with 7 additions and 3 deletions

View File

@ -42,7 +42,7 @@ import GenerateSingleArticleForm from "./generate-ai-single-form";
import { convertDateFormatNoTime, htmlToString } from "@/utils/global";
import { close, error, loading } from "@/config/swal";
import { useParams, useRouter } from "next/navigation";
import { list } from "postcss";
import { fromJSON, list } from "postcss";
import GetSeoScore from "./get-seo-score-form";
import Link from "next/link";
import { stringify } from "querystring";
@ -276,7 +276,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
const save = async (values: z.infer<typeof createArticleSchema>) => {
loading();
const formData = {
const formData: any = {
id: Number(id),
title: values.title,
typeId: 1,
@ -285,8 +285,12 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
tags: values.tags.join(","),
description: htmlToString(values.description),
htmlDescription: values.description,
createdAt: `${startDateValue} ${timeValue}:00`,
// createdAt: `${startDateValue} ${timeValue}:00`,
};
if (startDateValue && timeValue) {
formData.createdAt = `${startDateValue} ${timeValue}:00`;
}
const response = await updateArticle(String(id), formData);
if (response?.error) {