This commit is contained in:
@@ -61,6 +61,8 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.$store.state.authenticated) {
|
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" });
|
this.$router.replace({ name: "login" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,6 +52,27 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
APIUrl(apiPath) {
|
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 <protocol>//<hostname>:<port>/
|
||||||
|
store.commit(
|
||||||
|
"setAPIURL",
|
||||||
|
window.location.protocol +
|
||||||
|
"//" +
|
||||||
|
window.location.hostname +
|
||||||
|
":" +
|
||||||
|
window.location.port +
|
||||||
|
"/api/v8.0/"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return store.state.apiUrl + apiPath;
|
return store.state.apiUrl + apiPath;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* xeslint-disable */
|
/* eslint-disable */
|
||||||
import apiUtil from "./apiutil";
|
import apiUtil from "./apiutil";
|
||||||
import { processLogin, processLogout } from "../utils/authutil";
|
import { processLogin, processLogout } from "../utils/authutil";
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default new Vuex.Store({
|
|||||||
plugins: [createPersistedState()],
|
plugins: [createPersistedState()],
|
||||||
state: {
|
state: {
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
apiUrl: "http://localhost:7575/api/v8.0/",
|
apiUrl: "", //http://localhost:7575/api/v8.0/
|
||||||
apiToken: "-",
|
apiToken: "-",
|
||||||
userId: 0,
|
userId: 0,
|
||||||
roles: 0,
|
roles: 0,
|
||||||
@@ -30,12 +30,16 @@ export default new Vuex.Store({
|
|||||||
state.roles = 0;
|
state.roles = 0;
|
||||||
state.navItems = [];
|
state.navItems = [];
|
||||||
state.localeText = {};
|
state.localeText = {};
|
||||||
|
state.apiUrl = "";
|
||||||
},
|
},
|
||||||
addNavItem(state, data) {
|
addNavItem(state, data) {
|
||||||
state.navItems.push(data);
|
state.navItems.push(data);
|
||||||
},
|
},
|
||||||
addLocaleText(state, data) {
|
addLocaleText(state, data) {
|
||||||
state.localeText[data.key] = data.value;
|
state.localeText[data.key] = data.value;
|
||||||
|
},
|
||||||
|
setAPIURL(state, data) {
|
||||||
|
state.apiUrl = data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {}
|
actions: {}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
login() {
|
login() {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
debugger;
|
||||||
|
//console.log("Login.vue::page url is:" + this.$route.query.page);
|
||||||
if (this.input.username != "" && this.input.password != "") {
|
if (this.input.username != "" && this.input.password != "") {
|
||||||
auth
|
auth
|
||||||
.authenticate(this.input.username, this.input.password)
|
.authenticate(this.input.username, this.input.password)
|
||||||
|
|||||||
@@ -28,12 +28,10 @@ refs:
|
|||||||
|
|
||||||
|
|
||||||
WEEK OF 2018-11-12 - RAVEN shell start work. YAY!
|
WEEK OF 2018-11-12 - RAVEN shell start work. YAY!
|
||||||
|
// eslint-disable-next-line
|
||||||
|
|
||||||
NEXT UP / CURRENTLY WORKING ON:
|
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)
|
- 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/"
|
- 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
|
- otherwise it just uses the current page url fixed up with the api path instead
|
||||||
|
|||||||
Reference in New Issue
Block a user