mirror of
https://github.com/wahyd4/badger.git
synced 2026-08-09 05:15:58 +10:00
11 lines
355 B
JavaScript
11 lines
355 B
JavaScript
export default function({ $axios, store }) {
|
|
$axios.onRequest(config => {
|
|
if (config.url.startsWith("/api") && config.url !== "/api/auth") {
|
|
if (store.state.auth.loggedIn) {
|
|
config.headers.common["Authorization"] = store.state.users.token;
|
|
config.headers.common["uid"] = store.state.users.currentUser.id;
|
|
}
|
|
}
|
|
});
|
|
}
|