@@ -23,7 +23,7 @@ export const install: Install<Router | PluginOptions> = (
2323 const app : any = { }
2424 let router : Router
2525 let globalMiddlewares : Middleware [ ] = [ ]
26- let context : RouteContext = { app }
26+ let context : RouteContext = { app : vue }
2727
2828 if ( options && ( options as PluginOptions ) . router ) {
2929 // if options object
@@ -97,17 +97,17 @@ export const install: Install<Router | PluginOptions> = (
9797 router . beforeEach ( routeHook )
9898
9999 // ==== helpers ============
100- app . $MiddlewarePlugin = true
101- app . $getMiddlewareContext = ( ) => {
100+ vue . $MiddlewarePlugin = true
101+ vue . $getMiddlewareContext = ( ) => {
102102 const { app, ..._context } = context
103103 return _context
104104 }
105- app . $setMiddlewareContext = ( _context : any ) : any => {
105+ vue . $setMiddlewareContext = ( _context : any ) : any => {
106106 const { app, to, from, redirect } = context
107107 context = { ..._context , app, to, from, redirect }
108108 return context
109109 }
110- app . $updateMiddlewareContext = ( key : string , value : any ) => {
110+ vue . $updateMiddlewareContext = ( key : string , value : any ) => {
111111 const { app, to, from, redirect } = context
112112 context = { [ key ] : value , app, to, from, redirect }
113113 }
0 commit comments