Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { beautyBusinessApi } from "@/modules/beauty/services/beauty-business-api";
|
|
import { useTenantId } from "@/hooks/useTenantId";
|
|
import {
|
|
PageHeader,
|
|
DataTable,
|
|
EmptyState,
|
|
LoadingState,
|
|
ErrorState,
|
|
Badge,
|
|
} from "@/components/ds";
|
|
|
|
export default function StationsPage() {
|
|
const { tenantId } = useTenantId();
|
|
|
|
const listQ = useQuery({
|
|
queryKey: ["beauty", tenantId, "stations"],
|
|
queryFn: () => beautyBusinessApi.stations.list(tenantId!),
|
|
enabled: !!tenantId,
|
|
});
|
|
|
|
if (!tenantId || listQ.isLoading) return <LoadingState />;
|
|
if (listQ.error) {
|
|
return <ErrorState message={listQ.error.message} onRetry={() => listQ.refetch()} />;
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<PageHeader title="ایستگاهها" description="ایستگاههای کاری سالن." />
|
|
<DataTable
|
|
columns={[
|
|
{ key: "code", header: "کد" },
|
|
{ key: "name", header: "نام" },
|
|
{
|
|
key: "status",
|
|
header: "وضعیت",
|
|
render: (r) => <Badge>{String(r.status)}</Badge>,
|
|
},
|
|
]}
|
|
rows={(listQ.data ?? []) as unknown as Record<string, unknown>[]}
|
|
empty={<EmptyState title="ایستگاهی ثبت نشده" />}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|