From f7fd2d2de42a4ac28d3ef30e7418d8595d0717d0 Mon Sep 17 00:00:00 2001 From: Yashodhan Singh Date: Thu, 30 Jan 2020 15:04:39 +0530 Subject: [PATCH] refactor: install --- src/install.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/install.ts b/src/install.ts index 7aeb953..0b24279 100644 --- a/src/install.ts +++ b/src/install.ts @@ -23,7 +23,7 @@ export const install: Install = ( const app: any = {} let router: Router let globalMiddlewares: Middleware[] = [] - let context: RouteContext = { app } + let context: RouteContext = { app: vue } if (options && (options as PluginOptions).router) { // if options object @@ -97,17 +97,17 @@ export const install: Install = ( router.beforeEach(routeHook) // ==== helpers ============ - app.$MiddlewarePlugin = true - app.$getMiddlewareContext = () => { + vue.$MiddlewarePlugin = true + vue.$getMiddlewareContext = () => { const { app, ..._context } = context return _context } - app.$setMiddlewareContext = (_context: any): any => { + vue.$setMiddlewareContext = (_context: any): any => { const { app, to, from, redirect } = context context = { ..._context, app, to, from, redirect } return context } - app.$updateMiddlewareContext = (key: string, value: any) => { + vue.$updateMiddlewareContext = (key: string, value: any) => { const { app, to, from, redirect } = context context = { [key]: value, app, to, from, redirect } }