diff --git a/frontend/src/api.js b/frontend/src/api.js index 44842d4c368765e3b9899343ce20402cdd4234bc..007ebc14f9879211e782a5c0d6d03d209c8b48b5 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -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')} }) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index c48d87c0ae9cd7ee5bd6296e742d681e0a4000c2..09af47903cae284c2322f2a09481df7cefe7f1cf 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -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,