2060 create a new api key (#2206)
* Add folder for api settings * Init create api key page * Update create api key page * Implement api call to create apiKey * Add create api key mutation * Get id when creating apiKey * Display created Api Key * Add delete api key button * Remove button from InputText * Update stuff * Add test for ApiDetail * Fix type * Use recoil instead of router state * Remane route paths * Remove online return * Move and test date util * Remove useless Component * Rename ApiKeys paths * Rename ApiKeys files * Add input text info testing * Rename hooks to webhooks * Remove console error * Add tests to reach minimum coverage
This commit is contained in:
@ -8,23 +8,41 @@ import { UserProvider } from '~/modules/users/components/UserProvider';
|
||||
|
||||
import { FullHeightStorybookLayout } from '../FullHeightStorybookLayout';
|
||||
|
||||
export type PageDecoratorArgs = { routePath: string; routeParams: RouteParams };
|
||||
export type PageDecoratorArgs = {
|
||||
routePath: string;
|
||||
routeParams: RouteParams;
|
||||
state?: string;
|
||||
};
|
||||
|
||||
type RouteParams = {
|
||||
[param: string]: string;
|
||||
};
|
||||
|
||||
const computeLocation = (routePath: string, routeParams: RouteParams) =>
|
||||
routePath.replace(/:(\w+)/g, (paramName) => routeParams[paramName] ?? '');
|
||||
const computeLocation = (
|
||||
routePath: string,
|
||||
routeParams: RouteParams,
|
||||
state?: string,
|
||||
) => {
|
||||
return {
|
||||
pathname: routePath.replace(
|
||||
/:(\w+)/g,
|
||||
(paramName) => routeParams[paramName] ?? '',
|
||||
),
|
||||
state,
|
||||
};
|
||||
};
|
||||
|
||||
export const PageDecorator: Decorator<{
|
||||
routePath: string;
|
||||
routeParams: RouteParams;
|
||||
state?: string;
|
||||
}> = (Story, { args }) => (
|
||||
<UserProvider>
|
||||
<ClientConfigProvider>
|
||||
<MemoryRouter
|
||||
initialEntries={[computeLocation(args.routePath, args.routeParams)]}
|
||||
initialEntries={[
|
||||
computeLocation(args.routePath, args.routeParams, args.state),
|
||||
]}
|
||||
>
|
||||
<FullHeightStorybookLayout>
|
||||
<HelmetProvider>
|
||||
|
||||
Reference in New Issue
Block a user