Add board selector to top navigation
This commit is contained in:
1 parent
a1f3ad89f6
commit
e2b391af28
5 files changed
+128
-6
No files matched your search
@@ -3,14 +3,21 @@ import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
|
||||
export function useBoardsQuery({ teamId }: { teamId?: string }, options?: ReactQueryOptions) {
|
||||
export function useBoardsQuery(
|
||||
{ teamId }: { teamId?: string },
|
||||
params?: Record<string, any>,
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { modified } = useModified('boards');
|
||||
const { get } = useApi();
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['boards', { teamId, modified }],
|
||||
queryKey: ['boards', { teamId, modified, ...params }],
|
||||
queryFn: pageParams => {
|
||||
return get(teamId ? `/teams/${teamId}/boards` : '/boards', pageParams);
|
||||
return get(teamId ? `/teams/${teamId}/boards` : '/boards', {
|
||||
...pageParams,
|
||||
...params,
|
||||
});
|
||||
},
|
||||
...options,
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ export function useNavigation() {
|
||||
const [, websiteId] = pathname.match(/\/websites\/([a-f0-9-]+)/) || [];
|
||||
const [, linkId] = pathname.match(/\/links\/([a-f0-9-]+)/) || [];
|
||||
const [, pixelId] = pathname.match(/\/pixels\/([a-f0-9-]+)/) || [];
|
||||
const [, boardId] = pathname.match(/\/boards\/([a-f0-9-]+)/) || [];
|
||||
const [queryParams, setQueryParams] = useState(Object.fromEntries(searchParams));
|
||||
|
||||
const updateParams = (params?: Record<string, string | number>) => {
|
||||
@@ -40,6 +41,7 @@ export function useNavigation() {
|
||||
websiteId,
|
||||
linkId,
|
||||
pixelId,
|
||||
boardId,
|
||||
updateParams,
|
||||
replaceParams,
|
||||
renderUrl,
|
||||
|
||||
Reference in new issue
Block a user