import { NavigateFunction, To, useNavigate } from 'react-router-dom';
import { basename } from './basename';
/**
 * 如果有basepath，刚好给path加上basepath
 * @returns NavigateFunction
 */
export const useNewNavigate = (): NavigateFunction => {
  const navigate = useNavigate();
  const fn = (path: To, data?: any) => {
    // navigate(basename + '/' + path, data);
    navigate(path, data);
  };
  return fn as NavigateFunction;
};
