refactor: update loaderData imports in dashboard pages for consistency
This commit is contained in:
@@ -6,9 +6,11 @@ import type { TCategoryResponse } from '~/apis/common/get-categories'
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { UiTable } from '~/components/ui/table'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
import type { loader } from '~/routes/_admin.lg-admin'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard'
|
||||
export const CategoriesPage = () => {
|
||||
const loaderData = useRouteLoaderData<typeof loader>('routes/_admin.lg-admin')
|
||||
const loaderData = useRouteLoaderData<typeof loader>(
|
||||
'routes/_admin.lg-admin._dashboard',
|
||||
)
|
||||
|
||||
DataTable.use(DT)
|
||||
const dataTable = loaderData?.categoriesData?.sort((a, b) => {
|
||||
|
||||
@@ -5,11 +5,11 @@ import { Link, useRouteLoaderData } from 'react-router'
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { UiTable } from '~/components/ui/table'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard.tags._index'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard'
|
||||
|
||||
export const TagsPage = () => {
|
||||
const loaderData = useRouteLoaderData<typeof loader>(
|
||||
'routes/_admin.lg-admin._dashboard.tags._index',
|
||||
'routes/_admin.lg-admin._dashboard',
|
||||
)
|
||||
const { tagsData: dataTable } = loaderData || {}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Combobox } from '~/components/ui/combobox'
|
||||
import { Input } from '~/components/ui/input'
|
||||
import { Switch } from '~/components/ui/switch'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
import type { loader } from '~/routes/_admin.lg-admin'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard'
|
||||
|
||||
export const contentSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
@@ -64,7 +64,9 @@ export const FormContentsPage = (properties: TProperties) => {
|
||||
const { newsData } = properties || {}
|
||||
const fetcher = useFetcher()
|
||||
const navigate = useNavigate()
|
||||
const loaderData = useRouteLoaderData<typeof loader>('routes/_admin.lg-admin')
|
||||
const loaderData = useRouteLoaderData<typeof loader>(
|
||||
'routes/_admin.lg-admin._dashboard',
|
||||
)
|
||||
const { categoriesData: categories } = loaderData || {}
|
||||
const { tagsData: tags } = loaderData || {}
|
||||
const [error, setError] = useState<string>()
|
||||
|
||||
Reference in New Issue
Block a user