diff --git a/app/ayanova/src/App.vue b/app/ayanova/src/App.vue index cf78b28f..fcae2483 100644 --- a/app/ayanova/src/App.vue +++ b/app/ayanova/src/App.vue @@ -61,6 +61,8 @@ export default { }, mounted() { if (!this.$store.state.authenticated) { + // eslint-disable-next-line + console.log("App.vue::page url is:" + this.$route.query.page); this.$router.replace({ name: "login" }); } }, diff --git a/app/ayanova/src/api/apiutil.js b/app/ayanova/src/api/apiutil.js index 48f20835..1095f3e3 100644 --- a/app/ayanova/src/api/apiutil.js +++ b/app/ayanova/src/api/apiutil.js @@ -52,6 +52,27 @@ export default { }; }, APIUrl(apiPath) { + if ("" == store.state.apiUrl) { + //construct the api url and store it + //development location? + if ( + window.location.host == "localhost" && + window.location.port == "8080" + ) { + store.commit("setAPIURL", "http://localhost:7575/api/v8.0/"); + } else { + //production location //:/ + store.commit( + "setAPIURL", + window.location.protocol + + "//" + + window.location.hostname + + ":" + + window.location.port + + "/api/v8.0/" + ); + } + } return store.state.apiUrl + apiPath; } }; diff --git a/app/ayanova/src/api/auth.js b/app/ayanova/src/api/auth.js index ad4b08c9..1f231d68 100644 --- a/app/ayanova/src/api/auth.js +++ b/app/ayanova/src/api/auth.js @@ -1,4 +1,4 @@ -/* xeslint-disable */ +/* eslint-disable */ import apiUtil from "./apiutil"; import { processLogin, processLogout } from "../utils/authutil"; diff --git a/app/ayanova/src/store.js b/app/ayanova/src/store.js index caa8aee8..ca10ecd6 100644 --- a/app/ayanova/src/store.js +++ b/app/ayanova/src/store.js @@ -8,7 +8,7 @@ export default new Vuex.Store({ plugins: [createPersistedState()], state: { authenticated: false, - apiUrl: "http://localhost:7575/api/v8.0/", + apiUrl: "", //http://localhost:7575/api/v8.0/ apiToken: "-", userId: 0, roles: 0, @@ -30,12 +30,16 @@ export default new Vuex.Store({ state.roles = 0; state.navItems = []; state.localeText = {}; + state.apiUrl = ""; }, addNavItem(state, data) { state.navItems.push(data); }, addLocaleText(state, data) { state.localeText[data.key] = data.value; + }, + setAPIURL(state, data) { + state.apiUrl = data; } }, actions: {} diff --git a/app/ayanova/src/views/login.vue b/app/ayanova/src/views/login.vue index faa0d97c..eaceb683 100644 --- a/app/ayanova/src/views/login.vue +++ b/app/ayanova/src/views/login.vue @@ -52,6 +52,9 @@ export default { }, methods: { login() { + // eslint-disable-next-line + debugger; + //console.log("Login.vue::page url is:" + this.$route.query.page); if (this.input.username != "" && this.input.password != "") { auth .authenticate(this.input.username, this.input.password) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 74731bdf..c2725f3c 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -28,12 +28,10 @@ refs: WEEK OF 2018-11-12 - RAVEN shell start work. YAY! - +// eslint-disable-next-line NEXT UP / CURRENTLY WORKING ON: - - - - Look over the (now two) api calls and look for optimization and code shrinkage / de-duplication + - apiurl handling (really only matters for development, there is no scenario yet where it would matter in release) - if teh current page was loaded from http://localhost:8080/login then apiurl is automatically set to apiUrl:"http://localhost:7575/api/v8.0/" - otherwise it just uses the current page url fixed up with the api path instead