feat: refactor API response schemas for improve consistency
This commit is contained in:
@@ -2,9 +2,9 @@ import DT from 'datatables.net-dt'
|
||||
import DataTable from 'datatables.net-react'
|
||||
import { Link, useRouteLoaderData } from 'react-router'
|
||||
|
||||
import type { TNewsSchema } from '~/apis/admin/get-news'
|
||||
import type { TCategorySchema } from '~/apis/common/get-categories'
|
||||
import type { TTagSchema } from '~/apis/common/get-tags'
|
||||
import type { TNewsResponse } from '~/apis/admin/get-news'
|
||||
import type { TCategoryResponse } from '~/apis/common/get-categories'
|
||||
import type { TTagResponse } from '~/apis/common/get-tags'
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { UiTable } from '~/components/ui/table'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
@@ -55,14 +55,15 @@ export const ContentsPage = () => {
|
||||
]
|
||||
const dataSlot = {
|
||||
1: (value: string) => formatDate(value),
|
||||
2: (_value: unknown, _type: unknown, data: TNewsSchema) => (
|
||||
2: (_value: unknown, _type: unknown, data: TNewsResponse) => (
|
||||
<div>
|
||||
<div>{data.author.name}</div>
|
||||
<div className="text-sm text-[#7C7C7C]">ID: {data.id.slice(0, 8)}</div>
|
||||
</div>
|
||||
),
|
||||
4: (value: TCategorySchema[]) => value.map((item) => item.name).join(', '),
|
||||
5: (value: TTagSchema[]) => value.map((item) => item.name).join(', '),
|
||||
4: (value: TCategoryResponse[]) =>
|
||||
value.map((item) => item.name).join(', '),
|
||||
5: (value: TTagResponse[]) => value.map((item) => item.name).join(', '),
|
||||
6: (value: string) =>
|
||||
value ? (
|
||||
<div className="rounded-full bg-[#FFFCAF] px-2 text-center text-[#DBCA6E]">
|
||||
|
||||
Reference in New Issue
Block a user