fix:edit article
This commit is contained in:
parent
bca3031c61
commit
4be33b9111
|
|
@ -42,7 +42,7 @@ import GenerateSingleArticleForm from "./generate-ai-single-form";
|
||||||
import { convertDateFormatNoTime, htmlToString } from "@/utils/global";
|
import { convertDateFormatNoTime, htmlToString } from "@/utils/global";
|
||||||
import { close, error, loading } from "@/config/swal";
|
import { close, error, loading } from "@/config/swal";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
import { list } from "postcss";
|
import { fromJSON, list } from "postcss";
|
||||||
import GetSeoScore from "./get-seo-score-form";
|
import GetSeoScore from "./get-seo-score-form";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { stringify } from "querystring";
|
import { stringify } from "querystring";
|
||||||
|
|
@ -276,7 +276,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
||||||
|
|
||||||
const save = async (values: z.infer<typeof createArticleSchema>) => {
|
const save = async (values: z.infer<typeof createArticleSchema>) => {
|
||||||
loading();
|
loading();
|
||||||
const formData = {
|
const formData: any = {
|
||||||
id: Number(id),
|
id: Number(id),
|
||||||
title: values.title,
|
title: values.title,
|
||||||
typeId: 1,
|
typeId: 1,
|
||||||
|
|
@ -285,8 +285,12 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
||||||
tags: values.tags.join(","),
|
tags: values.tags.join(","),
|
||||||
description: htmlToString(values.description),
|
description: htmlToString(values.description),
|
||||||
htmlDescription: 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);
|
const response = await updateArticle(String(id), formData);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue