mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
15 lines
410 B
TypeScript
15 lines
410 B
TypeScript
import { defineNuxtRouteMiddleware, navigateTo } from 'nuxt/app';
|
|
|
|
import useConfig from '../composables/useConfig.ts';
|
|
|
|
export default defineNuxtRouteMiddleware((to) => {
|
|
const config = useConfig();
|
|
|
|
const redirect = config.redirects.find((redirectConfig) => {
|
|
return new RegExp(redirectConfig.from).test(to.path);
|
|
});
|
|
if (redirect) {
|
|
return navigateTo(redirect.to);
|
|
}
|
|
});
|