mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 23:55:36 +00:00
fix: doc path (#5393)
This commit is contained in:
@@ -29,16 +29,16 @@ export default function NotFound() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
const tryRedirect = async () => {
|
||||
(async () => {
|
||||
if (exactMap[pathname]) {
|
||||
router.replace(exactMap[pathname]);
|
||||
window.location.replace(exactMap[pathname]);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const [oldPrefix, newPrefix] of Object.entries(prefixMap)) {
|
||||
if (pathname.startsWith(oldPrefix)) {
|
||||
const rest = pathname.slice(oldPrefix.length);
|
||||
router.replace(newPrefix + rest);
|
||||
window.location.replace(newPrefix + rest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -54,17 +54,15 @@ export default function NotFound() {
|
||||
|
||||
if (validPage) {
|
||||
console.log('validPage', validPage);
|
||||
router.replace(validPage);
|
||||
window.location.replace(validPage);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('meta.json fallback failed:', e);
|
||||
}
|
||||
|
||||
router.replace(fallbackRedirect);
|
||||
};
|
||||
|
||||
tryRedirect();
|
||||
window.location.replace(fallbackRedirect);
|
||||
})();
|
||||
}, [pathname, router]);
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user