Skip to content
Snippets Groups Projects
Commit f755ec8c authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

axios base url and vuex strict mode dependant on NODE_ENV

parent b6a34a1c
No related branches found
No related tags found
1 merge request!53axios base url and vuex strict mode dependant on NODE_ENV
Pipeline #
......@@ -6,8 +6,16 @@ function addFieldsToUrl ({url, fields = []}) {
return fields.length > 0 ? url + '?fields=pk,' + fields : url
}
function getInstanceBaseUrl () {
if (process.env.NODE_ENV === 'production') {
return `https://${window.location.host}${window.location.pathname}`
} else {
return 'http://localhost:8000/'
}
}
let ax = axios.create({
baseURL: 'http://localhost:8000/',
baseURL: getInstanceBaseUrl(),
headers: {'Authorization': 'JWT ' + sessionStorage.getItem('token')}
})
......
......@@ -30,7 +30,7 @@ export const persistedStateKey = 'grady'
const store = new Vuex.Store({
// TODO only enable this in dev and not in deployment (use env variable)
strict: true,
strict: process.env.NODE_ENV === 'development',
modules: {
authentication,
studentPage,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment