Merge remote-tracking branch 'origin/iipbs/as/dev' into iipbs/as/dev
This commit is contained in:
@@ -14,6 +14,10 @@ export const ENDPOINT = {
|
||||
ELAPR_TMPLT: "/as-elapr-service/api/v1/elapr-tmplt",
|
||||
ELAPR_APLN: "/as-elapr-service/api/v1/elapr-apln",
|
||||
},
|
||||
AS_CHECKLIST_SERVICE: {
|
||||
CKLST: "/as-checklist-service/api/v1/cklst",
|
||||
CKLST_ARTCL: "/as-checklist-service/api/v1/cklst-artcl",
|
||||
},
|
||||
CMS_SERVICE: {
|
||||
CODE: "/cms-service/api/v1/code/cache",
|
||||
MENU_ROLES: "/cms-service/api/v1/menu-roles",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { HTMLAttributes } from "react";
|
||||
|
||||
import type { UseQueryResult } from "@tanstack/react-query";
|
||||
import { useReactTable, type TableOptions } from "@tanstack/react-table";
|
||||
import { DataTable } from "@common/components";
|
||||
import { type TableOptions, useReactTable } from "@tanstack/react-table";
|
||||
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
import { NoData } from "@/shared/ui/no-data";
|
||||
import { DataTable, Skeleton } from "@common/components";
|
||||
|
||||
import { matchQueryStatus } from "./match-query-status";
|
||||
|
||||
@@ -21,11 +22,7 @@ interface UseDataTableOptions<T> {
|
||||
dataTableOptions?: DataTableOptions<T>;
|
||||
}
|
||||
|
||||
export function useDataTable<T>({
|
||||
query,
|
||||
tableOptions,
|
||||
dataTableOptions,
|
||||
}: UseDataTableOptions<T>) {
|
||||
export function useDataTable<T>({ query, tableOptions, dataTableOptions }: UseDataTableOptions<T>) {
|
||||
const table = useReactTable({
|
||||
...tableOptions,
|
||||
data: query.data?.content ?? [],
|
||||
@@ -34,7 +31,12 @@ export function useDataTable<T>({
|
||||
|
||||
return {
|
||||
tableComponent: matchQueryStatus(query, {
|
||||
Pending: <p className="py-8 text-center text-sm text-muted-foreground">로딩 중…</p>,
|
||||
Pending: (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem]" />
|
||||
<Skeleton className="h-[16rem]" />
|
||||
</div>
|
||||
),
|
||||
Empty: <NoData />,
|
||||
Success: () => <DataTable table={table} {...dataTableOptions} />,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user