mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Fix filter clear all button.
This commit is contained in:
parent
2411aeae8d
commit
8da72a693d
@ -4,7 +4,7 @@ import usePageQuery from 'hooks/usePageQuery';
|
|||||||
import styles from './FilterTags.module.css';
|
import styles from './FilterTags.module.css';
|
||||||
import useMessages from 'hooks/useMessages';
|
import useMessages from 'hooks/useMessages';
|
||||||
|
|
||||||
export default function FilterTags({ websiteId, params }) {
|
export default function FilterTags({ params }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const {
|
const {
|
||||||
router,
|
router,
|
||||||
@ -18,7 +18,7 @@ export default function FilterTags({ websiteId, params }) {
|
|||||||
|
|
||||||
function handleCloseFilter(param) {
|
function handleCloseFilter(param) {
|
||||||
if (!param) {
|
if (!param) {
|
||||||
router.push(`/websites/${websiteId}${view ? `?view=${view}` : ''}`);
|
router.push(resolveUrl({ view }, true));
|
||||||
} else {
|
} else {
|
||||||
router.push(resolveUrl({ [param]: undefined }));
|
router.push(resolveUrl({ [param]: undefined }));
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ export default function usePageQuery() {
|
|||||||
}, {});
|
}, {});
|
||||||
}, [search]);
|
}, [search]);
|
||||||
|
|
||||||
function resolveUrl(params) {
|
function resolveUrl(params, reset) {
|
||||||
return buildUrl(asPath.split('?')[0], { ...query, ...params });
|
return buildUrl(asPath.split('?')[0], { ...(reset ? {} : query), ...params });
|
||||||
}
|
}
|
||||||
|
|
||||||
return { pathname, query, resolveUrl, router };
|
return { pathname, query, resolveUrl, router };
|
||||||
|
Loading…
Reference in New Issue
Block a user