From cb43b8a39bf6046270f09b7ff0ff8384abaa5f69 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 29 Nov 2021 17:20:26 +0100 Subject: [PATCH] fix(core) Token should be added to headers instead of replacing them --- src/boot/axios.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 0e0ba44..ec6432d 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -54,7 +54,9 @@ export default boot(({ router }) => { api.interceptors.request.use((config) => { const store = useMainStore(); if (store.session?.token) { - config.headers = { Authorization: 'Bearer ' + store.session.token }; + config.headers = Object.assign(config.headers || {}, { + Authorization: `Bearer ${store.session.token}`, + }); } // Minify JSON requests if (