This commit is contained in:
@@ -303,6 +303,10 @@ export default {
|
||||
//redirect to login if not authenticated
|
||||
if (!this.$store.state.authenticated) {
|
||||
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
|
||||
|
||||
@@ -7,7 +7,17 @@ export default {
|
||||
// Deal with a request to open an object (from main datatables mainly)
|
||||
// called from App.vue
|
||||
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
|
||||
|
||||
if (tid.type && tid.id != null) {
|
||||
|
||||
@@ -10,7 +10,7 @@ Vue.use(Vuex);
|
||||
export default new Vuex.Store({
|
||||
plugins: [createPersistedState()],
|
||||
state: {
|
||||
openObject: {},
|
||||
openObject: null,
|
||||
lastClientVersion: "",
|
||||
authenticated: false,
|
||||
apiUrl: "",
|
||||
@@ -128,6 +128,9 @@ export default new Vuex.Store({
|
||||
//data should be format for open-object-handler
|
||||
// { type: [AYATYPE], id: [RECORDID] }
|
||||
state.openObject = data;
|
||||
},
|
||||
clearOpenObject(state) {
|
||||
state.openObject = null;
|
||||
}
|
||||
},
|
||||
actions: {}
|
||||
|
||||
@@ -226,8 +226,8 @@ export default {
|
||||
window.$gz.api
|
||||
.get("notify/hello")
|
||||
.then(res => {
|
||||
if (res.data) {
|
||||
// console.log("res.data:", res.data);
|
||||
if (res.data != null) {
|
||||
// console.log("res.data:", res.data);
|
||||
vm.trialMode = !res.data;
|
||||
}
|
||||
})
|
||||
@@ -260,7 +260,11 @@ export default {
|
||||
auth
|
||||
.authenticate(vm.input.username, vm.input.password)
|
||||
.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) {
|
||||
//bad creds?
|
||||
|
||||
Reference in New Issue
Block a user