1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

refactor(edge/stacks): migrate envs table to react [EE-5613] (#9093)

This commit is contained in:
Chaim Lev-Ari 2023-06-25 12:38:43 +07:00 committed by GitHub
parent dfc1a7b1d7
commit 11571fd6ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 652 additions and 281 deletions

View file

@ -0,0 +1,19 @@
import { useCurrentStateAndParams, useRouter } from '@uirouter/react';
export function useParamState<T>(
param: string,
parseParam: (param: string | undefined) => T | undefined
) {
const {
params: { [param]: paramValue },
} = useCurrentStateAndParams();
const router = useRouter();
const state = parseParam(paramValue);
return [
state,
(value: T | undefined) => {
router.stateService.go('.', { [param]: value });
},
] as const;
}