32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { DashboardShell } from '../../../components/dashboard-shell';
|
|
import { ContactsDirectoryBoard } from '../../../components/contacts-directory-board';
|
|
import { requireAuthToken } from '../../../lib/auth';
|
|
import { fetchContactsDirectory } from '../../../lib/api';
|
|
|
|
export default async function ContactsPage({
|
|
searchParams,
|
|
}: {
|
|
searchParams?: Promise<{
|
|
page?: string;
|
|
limit?: string;
|
|
search?: string;
|
|
status?: string;
|
|
tag?: string;
|
|
}>;
|
|
}) {
|
|
const token = await requireAuthToken();
|
|
const query = await searchParams;
|
|
const page = Math.max(1, Number(query?.page || '1'));
|
|
const limit = Math.max(1, Number(query?.limit || '10'));
|
|
const search = query?.search || '';
|
|
const status = query?.status || '';
|
|
const tag = query?.tag || '';
|
|
const data = await fetchContactsDirectory(token, { page, limit, search, status, tag });
|
|
|
|
return (
|
|
<DashboardShell currentPath="/dashboard/contacts">
|
|
<ContactsDirectoryBoard data={data} filters={{ search, status, tag }} />
|
|
</DashboardShell>
|
|
);
|
|
}
|