New useNavigateApp (#9729)

Todo : 
- replace all instances of useNavigate(
- remove getSettingsPagePath
- add eslint rule to enfore usage of useNavigateApp instead of
useNavigate
This commit is contained in:
Félix Malfait
2025-01-18 13:58:12 +01:00
committed by GitHub
parent 8572471973
commit 152902d1be
115 changed files with 975 additions and 679 deletions

View File

@ -0,0 +1,20 @@
import { AppPath } from '@/types/AppPath';
import { useNavigate } from 'react-router-dom';
import { getAppPath } from '~/utils/navigation/getAppPath';
export const useNavigateApp = () => {
const navigate = useNavigate();
return <T extends AppPath>(
to: T,
params?: Parameters<typeof getAppPath<T>>[1],
queryParams?: Record<string, any>,
options?: {
replace?: boolean;
state?: any;
},
) => {
const path = getAppPath(to, params, queryParams);
return navigate(path, options);
};
};