Reinitialized commit. Update and actors overview with some filters.

This commit is contained in:
2023-12-30 06:29:53 +01:00
commit 3f099b5e95
1208 changed files with 134732 additions and 0 deletions

18
src/navigate.js Normal file
View File

@@ -0,0 +1,18 @@
export default function navigate(path, query, options = {}) {
const curatedQuery = Object.fromEntries(Object.entries(query || {}).map(([key, value]) => (value === undefined ? null : [key, value])).filter(Boolean));
const queryString = new URLSearchParams({
...(options.preserveQuery ? Object.fromEntries(new URL(window.location).searchParams.entries()) : {}),
...curatedQuery,
}).toString();
const url = queryString
? `${path}?${encodeURI(decodeURIComponent(queryString))}` // URLSearchParams encodes commas, we don't want that
: path;
if (options.redirect) {
window.location.href = url;
} else {
history.pushState({}, '', url); // eslint-disable-line no-restricted-globals
}
}