feat: refactor import paths for content and category schemas to improve clarity and organization
This commit is contained in:
parent
3a15c0d945
commit
2c64d430bd
@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { HttpServer } from '~/libs/http-server'
|
import { HttpServer } from '~/libs/http-server'
|
||||||
import type { TCategorySchema } from '~/pages/dashboard-category-create'
|
import type { TCategorySchema } from '~/pages/form-category'
|
||||||
|
|
||||||
const categoryResponseSchema = z.object({
|
const categoryResponseSchema = z.object({
|
||||||
data: z.object({
|
data: z.object({
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { HttpServer } from '~/libs/http-server'
|
import { HttpServer } from '~/libs/http-server'
|
||||||
import type { TContentSchema } from '~/pages/contents-form'
|
import type { TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
const newsResponseSchema = z.object({
|
const newsResponseSchema = z.object({
|
||||||
data: z.object({
|
data: z.object({
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { HttpServer } from '~/libs/http-server'
|
import { HttpServer } from '~/libs/http-server'
|
||||||
import type { TContentSchema } from '~/pages/contents-form'
|
import type { TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
const newsResponseSchema = z.object({
|
const newsResponseSchema = z.object({
|
||||||
data: z.object({
|
data: z.object({
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export const createCategorySchema = z.object({
|
|||||||
})
|
})
|
||||||
export type TCategorySchema = z.infer<typeof createCategorySchema>
|
export type TCategorySchema = z.infer<typeof createCategorySchema>
|
||||||
|
|
||||||
export const CreateCategoryPage = () => {
|
export const FormCategoryPage = () => {
|
||||||
const fetcher = useFetcher()
|
const fetcher = useFetcher()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const formMethods = useRemixForm<TCategorySchema>({
|
const formMethods = useRemixForm<TCategorySchema>({
|
||||||
@ -60,7 +60,7 @@ type TProperties = {
|
|||||||
newsData?: z.infer<typeof newsResponseSchema>
|
newsData?: z.infer<typeof newsResponseSchema>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ContentsFormPage = (properties: TProperties) => {
|
export const FormContentsPage = (properties: TProperties) => {
|
||||||
const { newsData } = properties || {}
|
const { newsData } = properties || {}
|
||||||
const fetcher = useFetcher()
|
const fetcher = useFetcher()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { CreateCategoryPage } from '~/pages/dashboard-category-create'
|
import { FormCategoryPage } from '~/pages/form-category'
|
||||||
|
|
||||||
const DashboardCategoriesCreateLayout = () => <CreateCategoryPage />
|
const DashboardCategoriesCreateLayout = () => <FormCategoryPage />
|
||||||
export default DashboardCategoriesCreateLayout
|
export default DashboardCategoriesCreateLayout
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ContentsFormPage } from '~/pages/contents-form'
|
import { FormContentsPage } from '~/pages/form-contents'
|
||||||
|
|
||||||
const DashboardContentCreateLayout = () => <ContentsFormPage />
|
const DashboardContentCreateLayout = () => <FormContentsPage />
|
||||||
export default DashboardContentCreateLayout
|
export default DashboardContentCreateLayout
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { getNewsBySlug } from '~/apis/common/get-news-by-slug'
|
import { getNewsBySlug } from '~/apis/common/get-news-by-slug'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { ContentsFormPage } from '~/pages/contents-form'
|
import { FormContentsPage } from '~/pages/form-contents'
|
||||||
|
|
||||||
import type { Route } from './+types/_admin.lg-admin._dashboard.contents.update.$slug'
|
import type { Route } from './+types/_admin.lg-admin._dashboard.contents.update.$slug'
|
||||||
|
|
||||||
@ -15,6 +15,6 @@ export const loader = async ({ request }: Route.LoaderArgs) => {
|
|||||||
|
|
||||||
const DashboardContentUpdateLayout = ({ loaderData }: Route.ComponentProps) => {
|
const DashboardContentUpdateLayout = ({ loaderData }: Route.ComponentProps) => {
|
||||||
const newsData = loaderData.newsData
|
const newsData = loaderData.newsData
|
||||||
return <ContentsFormPage newsData={newsData} />
|
return <FormContentsPage newsData={newsData} />
|
||||||
}
|
}
|
||||||
export default DashboardContentUpdateLayout
|
export default DashboardContentUpdateLayout
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { handleCookie } from '~/libs/cookies'
|
|||||||
import {
|
import {
|
||||||
createCategorySchema,
|
createCategorySchema,
|
||||||
type TCategorySchema,
|
type TCategorySchema,
|
||||||
} from '~/pages/dashboard-category-create'
|
} from '~/pages/form-category'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.register'
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { XiorError } from 'xior'
|
|||||||
|
|
||||||
import { createNewsRequest } from '~/apis/admin/create-news'
|
import { createNewsRequest } from '~/apis/admin/create-news'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { contentSchema, type TContentSchema } from '~/pages/contents-form'
|
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.register'
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { XiorError } from 'xior'
|
|||||||
|
|
||||||
import { updateNewsRequest } from '~/apis/admin/update-news'
|
import { updateNewsRequest } from '~/apis/admin/update-news'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { contentSchema, type TContentSchema } from '~/pages/contents-form'
|
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.register'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user