mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
710 B
710 B
Routes
Usage
Path Factories
import { FACTORIES } from '@affine/routes';
const path = FACTORIES.workspace.doc({ workspaceId: '123', docId: '456' });
// ^^^^ with typecheck
Register router
import { ROUTES } from '@affine/routes';
function Routes() {
return <Router path={ROUTES.admin.index} element={} />;
}
Path Parameter
import { RouteParamsTypes } from '@affine/routes';
function Doc() {
const { workspaceId, docId } = useParams<RouteParamsTypes['workspace']['doc']>();
}
function Attachment() {
const { workspaceId, docId, attachmentId } = useParams<RouteParamsTypes['workspace']['doc']['attachment']>();
}