baked-recipe-admin
Version:
Baked is an opinionated framework for .NET in backend and Nuxt in frontend. This is a recipe package that brings together all the components one needs for an Admin UI.
19 lines (16 loc) • 395 B
JavaScript
import { defineNuxtPlugin } from "#app";
export default defineNuxtPlugin({
name: "trailingSlash",
enforce: "pre",
setup(nuxtApp) {
const router = nuxtApp.$router;
router.beforeEach(async to => {
if(to.path !== "/" && to.path.endsWith("/")) {
await router.replace({
path: to.path.slice(0, -1),
query: to.query
});
}
});
}
});