1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/frontend/src/utils/routePathHelpers.ts
Christopher Kolstad 5a3bb1ffc3
Biome1.5.1 (#5867)
Lots of work here, mostly because I didn't want to turn off the
`noImplicitAnyLet` lint. This PR tries its best to type all the untyped
lets biome complained about (Don't ask me how many hours that took or
how many lints that was >200...), which in the future will force test
authors to actually type their global variables setup in `beforeAll`.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-01-12 09:25:59 +00:00

28 lines
710 B
TypeScript

export const getTogglePath = (projectId: string, featureToggleName: string) => {
return `/projects/${projectId}/features/${featureToggleName}`;
};
export const getCreateTogglePath = (
projectId: string,
query?: Record<string, string>,
) => {
const path = `/projects/${projectId}/create-toggle`;
let queryString: string | undefined;
if (query) {
queryString = Object.keys(query).reduce((acc, curr) => {
return `${acc}${curr}=${query[curr]}`;
}, '');
}
if (queryString) {
return `${path}?${queryString}`;
}
return path;
};
export const getProjectEditPath = (projectId: string) => {
return `/projects/${projectId}/settings`;
};