File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ export const authorize = (options: MiddlewareOptions) => {
9
9
await next ( async ( vm : any ) => {
10
10
const { op, warrants, redirectTo } = options ;
11
11
12
- warrants . forEach ( ( warrant ) => {
12
+ let warrantsToCheck = [ ...warrants ] . map ( warrant => ( { ...warrant } ) ) ;
13
+ warrantsToCheck . forEach ( ( warrant ) => {
13
14
if ( to . params [ warrant . objectId ] ) {
14
15
/** @ts -ignore */
15
16
warrant . objectId = to . params [ warrant . objectId ] ;
@@ -20,7 +21,7 @@ export const authorize = (options: MiddlewareOptions) => {
20
21
}
21
22
} )
22
23
23
- const hasWarrant = await vm . $warrant . hasWarrant ( { op, warrants } ) ;
24
+ const hasWarrant = await vm . $warrant . hasWarrant ( { op, warrants : warrantsToCheck } ) ;
24
25
if ( ! hasWarrant ) {
25
26
next ( { path : redirectTo } ) ;
26
27
} else {
You can’t perform that action at this time.
0 commit comments