diff --git a/openflexure_microscope/api/static/src/store.js b/openflexure_microscope/api/static/src/store.js index 8b92ca38..31f1fd0a 100644 --- a/openflexure_microscope/api/static/src/store.js +++ b/openflexure_microscope/api/static/src/store.js @@ -3,9 +3,22 @@ import Vuex from "vuex"; Vue.use(Vuex); +function getOriginFromLocation(){ + // This will default to the same origin that's serving + // the web app - but can be overridden by the URL. + // See also devTools.vue which can change the origin. + let url = new URL(window.location.href); + let origin = url.searchParams.get("overrideOrigin"); + if(origin){ + return origin; + }else{ + return url.origin; + } +} + export default new Vuex.Store({ state: { - origin: window.location.origin, + origin: getOriginFromLocation(), available: false, waiting: false, error: "",