This commit is contained in:
@@ -303,6 +303,10 @@ export default {
|
|||||||
//redirect to login if not authenticated
|
//redirect to login if not authenticated
|
||||||
if (!this.$store.state.authenticated) {
|
if (!this.$store.state.authenticated) {
|
||||||
this.$router.push("login");
|
this.$router.push("login");
|
||||||
|
} else {
|
||||||
|
//this can be safely called any time, it checks if there is an open object in store and
|
||||||
|
//opens it or if not just returns
|
||||||
|
window.$gz.eventBus.$emit("openobject", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FUTURE: If need to detect a reload, this works reliably
|
//FUTURE: If need to detect a reload, this works reliably
|
||||||
|
|||||||
@@ -7,7 +7,17 @@ export default {
|
|||||||
// Deal with a request to open an object (from main datatables mainly)
|
// Deal with a request to open an object (from main datatables mainly)
|
||||||
// called from App.vue
|
// called from App.vue
|
||||||
handleOpenObjectClick(vm, tid) {
|
handleOpenObjectClick(vm, tid) {
|
||||||
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
|
//expects extra data (tid) to be one of { type: [AYATYPE], id: [RECORDID] }
|
||||||
|
//or null which is what is called when asking to check if there is a direct openObject in store and open it
|
||||||
|
|
||||||
|
if (tid == null) {
|
||||||
|
let op = vm.$store.state.openObject;
|
||||||
|
if (op && op.type) {
|
||||||
|
tid = op;
|
||||||
|
window.$gz.store.commit("clearOpenObject");
|
||||||
|
} else return; //bail out, nothing to open here
|
||||||
|
}
|
||||||
|
|
||||||
//NOTE: for new objects all edit pages assume record ID 0 means create rather than open
|
//NOTE: for new objects all edit pages assume record ID 0 means create rather than open
|
||||||
|
|
||||||
if (tid.type && tid.id != null) {
|
if (tid.type && tid.id != null) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Vue.use(Vuex);
|
|||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
plugins: [createPersistedState()],
|
plugins: [createPersistedState()],
|
||||||
state: {
|
state: {
|
||||||
openObject: {},
|
openObject: null,
|
||||||
lastClientVersion: "",
|
lastClientVersion: "",
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
apiUrl: "",
|
apiUrl: "",
|
||||||
@@ -128,6 +128,9 @@ export default new Vuex.Store({
|
|||||||
//data should be format for open-object-handler
|
//data should be format for open-object-handler
|
||||||
// { type: [AYATYPE], id: [RECORDID] }
|
// { type: [AYATYPE], id: [RECORDID] }
|
||||||
state.openObject = data;
|
state.openObject = data;
|
||||||
|
},
|
||||||
|
clearOpenObject(state) {
|
||||||
|
state.openObject = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {}
|
actions: {}
|
||||||
|
|||||||
@@ -226,8 +226,8 @@ export default {
|
|||||||
window.$gz.api
|
window.$gz.api
|
||||||
.get("notify/hello")
|
.get("notify/hello")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data) {
|
if (res.data != null) {
|
||||||
// console.log("res.data:", res.data);
|
// console.log("res.data:", res.data);
|
||||||
vm.trialMode = !res.data;
|
vm.trialMode = !res.data;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -260,7 +260,11 @@ export default {
|
|||||||
auth
|
auth
|
||||||
.authenticate(vm.input.username, vm.input.password)
|
.authenticate(vm.input.username, vm.input.password)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
vm.$router.push(vm.$store.state.homePage);
|
if (vm.$store.state.openObject) {
|
||||||
|
window.$gz.eventBus.$emit("openobject", null);
|
||||||
|
} else {
|
||||||
|
vm.$router.push(vm.$store.state.homePage);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(function handleCaughtLoginError(error) {
|
.catch(function handleCaughtLoginError(error) {
|
||||||
//bad creds?
|
//bad creds?
|
||||||
|
|||||||
Reference in New Issue
Block a user