diff --git a/components/form/form-article.tsx b/components/form/form-article.tsx index 044dee5..0867c0c 100644 --- a/components/form/form-article.tsx +++ b/components/form/form-article.tsx @@ -1,5 +1,5 @@ "use client"; -import { error } from "@/config/swal"; +import { close, error, loading } from "@/config/swal"; import { createArticle, getArticleByCategory } from "@/service/article"; import { zodResolver } from "@hookform/resolvers/zod"; import { @@ -21,6 +21,7 @@ import withReactContent from "sweetalert2-react-content"; import * as z from "zod"; import ReactSelect from "react-select"; import makeAnimated from "react-select/animated"; +import { saveManualContext } from "@/service/generate-article"; const articleSchema = z.object({ title: z.string().min(1, { message: "Required" }), @@ -210,10 +211,37 @@ export default function FormArticle() { confirmButtonText: "Simpan", }).then((result) => { if (result.isConfirmed) { + // diseUpload(data); save(data); } }); } + + const diseUpload = async (data: any) => { + const request = { + title: data.title, + articleBody: content, + metaDescription: data.title, + metaTitle: data.title, + mainKeyword: data.title, + additionalKeywords: data.title, + createdBy: "123432", + style: "Informational", + projectId: 2, + clientId: "humasClientIdtest", + lang: "id", + }; + + loading(); + const res = await saveManualContext(request); + if (res.error) { + res.message; + return false; + } + close(); + save(data); + }; + return (