mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make typing of routes support synchronous values
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
3f28a09fa1
commit
9117bc2760
@ -232,5 +232,11 @@ export interface LensApiResult<TResult> {
|
||||
export interface Route<TResponse> {
|
||||
path: string;
|
||||
method: "get" | "post" | "put" | "patch" | "delete";
|
||||
handler: (request: LensApiRequest) => LensApiResult<TResponse> | Promise<LensApiResult<TResponse>>;
|
||||
handler: (
|
||||
request: LensApiRequest
|
||||
) =>
|
||||
| Promise<LensApiResult<TResponse>>
|
||||
| Promise<void>
|
||||
| LensApiResult<TResponse>
|
||||
| void;
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ const getMetricProvidersRouteInjectable = getInjectable({
|
||||
method: "get",
|
||||
path: `${apiPrefix}/metrics/providers`,
|
||||
|
||||
handler: async () => {
|
||||
handler: () => {
|
||||
const providers: MetricProviderInfo[] = [];
|
||||
|
||||
for (const { name, id, isConfigurable } of PrometheusProviderRegistry.getInstance().providers.values()) {
|
||||
|
||||
@ -14,9 +14,7 @@ const getVersionRouteInjectable = getInjectable({
|
||||
method: "get",
|
||||
path: `/version`,
|
||||
|
||||
handler: async () => {
|
||||
return { response: { version: getAppVersion() }};
|
||||
},
|
||||
handler: () => ({ response: { version: getAppVersion() }}),
|
||||
}),
|
||||
|
||||
injectionToken: routeInjectionToken,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user