UNPKG

288 BJavaScriptView Raw
1export default function asyncToken(instance, getToken) {
2 instance.interceptors.request.use(function (config) {
3 return getToken().then((accessToken) => {
4 config.headers.set('Authorization', `Bearer ${accessToken}`);
5 return config;
6 });
7 });
8}