import { Plugin } from '@nuxt/types' import Form from "~/services/store/form"; const routePlugin: Plugin = (ctx) => { if (ctx.app.router) { ctx.app.router.beforeEach((to, from, next) => { new Form(ctx.store).handleActionsAfterLeavePage(to) if (!ctx.store.state.form.dirty) { next() } }) ctx.app.router.afterEach(() => { }) } } export default routePlugin