@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_.
13 lines (10 loc) • 462 B
text/typescript
import { RouteParam } from '@prefecthq/vue-compositions'
import { LocationQueryValue } from 'vue-router'
export class JSONRouteParam extends RouteParam<Record<string, unknown>> {
protected override parse(value: LocationQueryValue): Record<string, unknown> {
return JSON.parse(decodeURIComponent(value ?? ''))
}
protected override format(value: Record<string, unknown>): LocationQueryValue {
return encodeURIComponent(JSON.stringify(value))
}
}