@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_.
18 lines (14 loc) • 534 B
text/typescript
import { InvalidRouteParamValue, RouteParam } from '@prefecthq/vue-compositions'
import { LocationQueryValue } from 'vue-router'
import { isOperation, Operation } from '@/models/Filters'
export class OperatorRouteParam extends RouteParam<Operation> {
protected override parse(value: LocationQueryValue): Operation {
if (value === null || !isOperation(value)) {
throw new InvalidRouteParamValue()
}
return value
}
protected override format(value: Operation): LocationQueryValue {
return `${value}`
}
}