mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 06:18:04 +00:00
* Introduced tsconfig.app.json and tsconfig.base.json * yarn.lock * Introduced tsconfig.app.json, tsconfig.base.jsonfig. * Refactored eslint.config.js to latest structure * Returned previous recommended rules. * More rules * Force import rules * Check * Check * Cleanup ESLint configuration and plugins * Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration * "scripts" moved to the top of package.json
27 lines
653 B
TypeScript
27 lines
653 B
TypeScript
import {
|
|
type NavigateOptions,
|
|
useLocation,
|
|
useNavigate,
|
|
useParams,
|
|
} from "react-router";
|
|
|
|
import { useAppContext } from "../context/AppContext";
|
|
|
|
const useNavigateWithSearchParams = () => {
|
|
const navigate = useNavigate();
|
|
const { clusterMode } = useAppContext();
|
|
const { context } = useParams();
|
|
|
|
const { search } = useLocation();
|
|
return async (url: string, ...restArgs: NavigateOptions[]) => {
|
|
let prefixedUrl = url;
|
|
|
|
if (!clusterMode) {
|
|
prefixedUrl = `/${encodeURIComponent(context ?? "")}${url}`;
|
|
}
|
|
await navigate(`${prefixedUrl}${search}`, ...restArgs);
|
|
};
|
|
};
|
|
|
|
export default useNavigateWithSearchParams;
|