Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 6x 11x 11x 11x 16x 11x 11x | import type { LocationQueryRaw, RouteLocationRaw } from "vue-router";
export const useListingQuery = (defaults: Record<string, string>) => {
const route = useRoute();
const router = useRouter();
const link = (patch: LocationQueryRaw): RouteLocationRaw => ({
query: Object.fromEntries(
Object.entries({ ...route.query, page: undefined, ...patch }).filter(
([name, value]) => value !== defaults[name],
),
),
});
const navigate = (patch: LocationQueryRaw) => router.push(link(patch));
return { link, navigate };
};
|