feat: implement createNews API and integrate with content creation flow

This commit is contained in:
Ardeman
2025-03-06 05:46:25 +08:00
parent 894698c5d6
commit 414806734d
4 changed files with 61 additions and 18 deletions
+6 -7
View File
@@ -3,6 +3,7 @@ import { data } from 'react-router'
import { getValidatedFormData } from 'remix-hook-form'
import { XiorError } from 'xior'
import { createNewsRequest } from '~/apis/admin/create-news'
import { handleCookie } from '~/libs/cookies'
import { contentSchema, type TContentSchema } from '~/pages/contents-create'
@@ -25,17 +26,15 @@ export const action = async ({ request }: Route.ActionArgs) => {
return data({ success: false, errors, defaultValues }, { status: 400 })
}
// TODO: implement subscribe
console.log('payload', payload) // eslint-disable-line no-console
console.log('staffToken', staffToken) // eslint-disable-line no-console
// const { data: userData } = await getUser({
// accessToken: userToken,
// })
const { data: newsData } = await createNewsRequest({
accessToken: staffToken,
payload,
})
return data(
{
success: true,
newsData,
},
{
status: 200,