@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
19 lines (15 loc) • 574 B
text/typescript
import { LocationQuery, LocationQueryRaw, Router } from 'vue-router'
import { Route } from '@/router'
export function withQuery(route: Route, query: LocationQueryRaw): Route {
return { ...route, query }
}
export function withRedirect(route: Route, redirect: string = window.location.pathname): Route {
return withQuery(route, { redirect })
}
export function clearSelectedFilters(router: Router, parameters: string[]): LocationQuery {
const query = { ...router.currentRoute.value.query }
parameters.forEach(param => {
delete query[param]
})
return query
}