Skip to content

Commit

Permalink
Eslint fixes
Browse files Browse the repository at this point in the history
Resolves Issue #75
  • Loading branch information
Nilumilak committed Feb 9, 2024
1 parent bd650ad commit 28c091e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 9 additions & 5 deletions frontend/src/lib/hooks/useAppParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ export default function useAppParams<
T extends { [K in keyof Params]?: string }
>() {
const params = useParams<T>() as T;

const hasClusterName = (params: T): params is T & ClusterNameRoute => typeof params.clusterName !== "undefined"

const hasClusterName = (
checkingParams: T
): checkingParams is T & ClusterNameRoute =>
typeof checkingParams.clusterName !== 'undefined';

if (hasClusterName(params)) {
params.clusterName = decodeURIComponent(params.clusterName)
params.clusterName = decodeURIComponent(params.clusterName);
}
return params

return params;
}
7 changes: 6 additions & 1 deletion frontend/src/lib/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export const accessErrorPage = '/403';

export const clusterPath = (
clusterName: ClusterName = RouteParams.clusterName
) => `/ui/clusters/${clusterName === RouteParams.clusterName ? clusterName : encodeURIComponent(clusterName)}`;
) =>
`/ui/clusters/${
clusterName === RouteParams.clusterName
? clusterName
: encodeURIComponent(clusterName)
}`;

export type ClusterNameRoute = { clusterName: ClusterName };

Expand Down

0 comments on commit 28c091e

Please sign in to comment.