diff --git a/package.json b/package.json index 2099c9a32..f0d587210 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@tailwindcss/typography": "^0.5.9", "@vitejs/plugin-vue2": "^2.2.0", "@vueuse/core": "^9.12.0", + "@vueuse/integrations": "^10.5.0", "autoprefixer": "^10.4.15", "axios": "^1.2.6", "cross-env": "^7.0.3", @@ -23,6 +24,7 @@ "rollup-plugin-visualizer": "^5.9.0", "tailwind-scrollbar-hide": "^1.1.7", "tailwindcss": "^3.3.3", + "universal-cookie": "^6.1.1", "vite": "^4.0.4", "vue": "^2.7", "vue-clickaway": "^2.2.2", diff --git a/resources/js/axios.js b/resources/js/axios.js index 5e36655a9..ff33caab9 100644 --- a/resources/js/axios.js +++ b/resources/js/axios.js @@ -1,6 +1,7 @@ import axios from 'axios' -window.axios = axios +import { token } from './stores/useUser' +window.axios = axios window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' window.magento = axios.create() @@ -8,7 +9,7 @@ window.magento.defaults.baseURL = config.magento_url + '/rest/' + config.store_c window.magentoUser = axios.create() window.magentoUser.defaults.baseURL = config.magento_url + '/rest/' + config.store_code + '/V1/' -window.magentoUser.defaults.headers.common['Authorization'] = `Bearer ${localStorage.token}` +window.magentoUser.defaults.headers.common['Authorization'] = `Bearer ${token.value}` // It's not possible to set global interceptors like headers // or the base url can; so we set them for all instances. diff --git a/resources/js/components/Checkout/CheckoutSuccess.vue b/resources/js/components/Checkout/CheckoutSuccess.vue index e59c83ab9..1ca75efdb 100644 --- a/resources/js/components/Checkout/CheckoutSuccess.vue +++ b/resources/js/components/Checkout/CheckoutSuccess.vue @@ -1,5 +1,6 @@