This commit is contained in:
2020-07-23 18:10:35 +00:00
parent 506ab7de11
commit 8a713c2b1f
4 changed files with 46 additions and 16 deletions

View File

@@ -324,23 +324,23 @@ export default {
//this smells bad but it works //this smells bad but it works
vm.$root.$gz = window.$gz; vm.$root.$gz = window.$gz;
//Capture open object type and id if present // //Capture open object type and id if present
//localhost:8080/login?type=2&id=22 // //localhost:8080/login?type=2&id=22
if (window.location.search) { // if (window.location.search) {
//https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams // //https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
var searchParams = new URLSearchParams(window.location.search); // var searchParams = new URLSearchParams(window.location.search);
var openObject = {}; // var openObject = {};
//data should be format for open-object-handler // //data should be format for open-object-handler
// { type: [AYATYPE], id: [RECORDID] } // // { type: [AYATYPE], id: [RECORDID] }
if (searchParams.has("type")) { // if (searchParams.has("type")) {
openObject.type = Number(searchParams.get("type")); // openObject.type = Number(searchParams.get("type"));
if (searchParams.has("id")) { // if (searchParams.has("id")) {
openObject.id = Number(searchParams.get("id")); // openObject.id = Number(searchParams.get("id"));
} // }
window.$gz.store.commit("setOpenObject", openObject); // window.$gz.store.commit("setOpenObject", openObject);
} // }
} // }
//redirect to login if not authenticated //redirect to login if not authenticated
if (!vm.$store.state.authenticated) { if (!vm.$store.state.authenticated) {

View File

@@ -31,6 +31,8 @@ export default {
//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) {
console.log("tid", tid);
console.log("ayatype", ayatype);
switch (tid.type) { switch (tid.type) {
case ayatype.Widget: case ayatype.Widget:
vm.$router.push({ vm.$router.push({

View File

@@ -428,6 +428,12 @@ export default new Router({
) )
}, },
//**********************************GENERAL */ //**********************************GENERAL */
{
path: "/open/:ayatype/:recordid",
name: "ay-open",
component: () =>
import(/* webpackChunkName: "ay-common" */ "./views/ay-open.vue")
},
{ {
path: "/about", path: "/about",
name: "ay-about", name: "ay-about",

View File

@@ -0,0 +1,22 @@
<template>
<div>Opening...</div>
</template>
<script>
export default {
data() {
return {};
},
created() {
//Capture open object type and id if present
// path: "/open/:ayatype/:recordid",
//vm.$route.params.ayatype
//vm.$route.params.recordid
//{ type: [AYATYPE], id: [RECORDID] }
window.$gz.eventBus.$emit("openobject", {
type: Number(this.$route.params.ayatype),
id: Number(this.$route.params.recordid)
});
}
};
</script>