Skip to content

Commit 6f4441a

Browse files
committed
improvement(opts-helpers): add function to add a property to middleware context
1 parent 8765640 commit 6f4441a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/install.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export const install: Install<Router | PluginOptions> = (
6666
context = { ..._context, app }
6767
return context
6868
}
69+
vue.$addMiddlewareContext = (key: string, value: any) => {
70+
context = { [key]: value, ...context }
71+
}
6972
vue.$updateMiddlewareContext = (key: string, value: any) => {
7073
if (key === 'app') {
7174
throw new BasePluginError(

0 commit comments

Comments
 (0)