diff --git a/deploy.sh b/deploy.sh index 0860139..1c2dd14 100755 --- a/deploy.sh +++ b/deploy.sh @@ -44,7 +44,7 @@ echo -e "${YELLOW}=======================================${RESET}" python manage.py migrate -echo -e "${BLUE}Restart Backend Gunicorn Service${RESET}" +echo -e "${BLUE}Restart Backend Services${RESET}" echo -e "${YELLOW}=======================================${RESET}" systemctl restart gunicorn-bookshelf.service systemctl restart celery_bookshelf.service diff --git a/frontend/src/services/axiosInstance.js b/frontend/src/services/axiosInstance.js index 729bc75..9e4122b 100644 --- a/frontend/src/services/axiosInstance.js +++ b/frontend/src/services/axiosInstance.js @@ -15,9 +15,12 @@ const api = axios.create({ api.interceptors.request.use( (config) => { console.log('\nURL', config.url) + const token = getAccessToken() if (config.requiresAuth) { - // Check for custom requiresAuth flag - const token = getAccessToken() + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + } else { if (token) { config.headers.Authorization = `Bearer ${token}` }