Skip to content

Commit e8e38f8

Browse files
committed
Added support token
1 parent 6ad6406 commit e8e38f8

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/plugin.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,23 @@ export const init = (ctx, inject) => {
4949
credentials: 'include'
5050
}
5151
});
52+
53+
const headers = {}
54+
if (
55+
ctx.store.getters['common/customer/token']
56+
) {
57+
headers['Authorization'] = `Bearer ${
58+
ctx.store.getters['common/customer/token']
59+
}`
60+
}
61+
62+
headers['Cookie'] = _.map(
63+
ctx.app.$cookies.getAll(),
64+
(value, index) => index + '=' + JSON.stringify(value)
65+
).join(';')
66+
5267
operation.setContext({
53-
headers: {
54-
'Cookie': _.map(ctx.app.$cookies.getAll(), (value, index) => (index + '=' + value)).join(';')
55-
}
68+
headers
5669
});
5770
}
5871
});

0 commit comments

Comments
 (0)