UNPKG

@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_.

23 lines (18 loc) 730 B
import { InvalidRouteParamValue, RouteParam } from '@prefecthq/vue-compositions' import { LocationQueryValue } from 'vue-router' import { VersionInfoFilter, isVersionInfoFilter } from '@/models/Filters' export class DeploymentVersionInfoRouteParam extends RouteParam<VersionInfoFilter> { protected override parse(value: LocationQueryValue): VersionInfoFilter { if (value === null || typeof value !== 'string') { throw new InvalidRouteParamValue() } const parsed = JSON.parse(value) if (!isVersionInfoFilter(parsed)) { throw new InvalidRouteParamValue() } return parsed } protected override format(value: VersionInfoFilter): LocationQueryValue { return JSON.stringify(value) } }