Add follow reference button for vanilla presets

This commit is contained in:
Misode
2021-11-21 03:49:46 +01:00
parent 08e5b36a62
commit 43d1b7dbcc
6 changed files with 29 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ export function getSearchParams(url: string) {
return new Map<string, string>()
}
export function setSeachParams(modifications: Record<string, string | undefined>) {
export function setSeachParams(modifications: Record<string, string | undefined>, newPath?: string) {
const url = getCurrentUrl()
const searchParams = getSearchParams(url)
Object.entries(modifications).forEach(([key, value]) => {
@@ -89,7 +89,7 @@ export function setSeachParams(modifications: Record<string, string | undefined>
})
const search = Array.from(searchParams).map(([key, value]) =>
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
route(`${getPath(url)}${search.length === 0 ? '' : `?${search.join('&')}`}`, true)
route(`${newPath ? cleanUrl(newPath) : getPath(url)}${search.length === 0 ? '' : `?${search.join('&')}`}`, true)
}
export function stringToColor(str: string): [number, number, number] {