mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Layout updates.
This commit is contained in:
parent
e4c5f42189
commit
476dd52875
23 changed files with 97 additions and 86 deletions
|
|
@ -1,27 +0,0 @@
|
|||
import { useMemo } from 'react';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { buildUrl } from 'next-basics';
|
||||
|
||||
export function usePageQuery() {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const params = useSearchParams();
|
||||
|
||||
const query = useMemo(() => {
|
||||
const obj = {};
|
||||
|
||||
for (const [key, value] of params.entries()) {
|
||||
obj[key] = decodeURIComponent(value);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}, [params]);
|
||||
|
||||
function resolveUrl(params, reset) {
|
||||
return buildUrl(pathname, { ...(reset ? {} : query) });
|
||||
}
|
||||
|
||||
return { pathname, query, resolveUrl, router };
|
||||
}
|
||||
|
||||
export default usePageQuery;
|
||||
Loading…
Add table
Add a link
Reference in a new issue