diff --git a/src/App.vue b/src/App.vue index 14d9cc0..8159000 100644 --- a/src/App.vue +++ b/src/App.vue @@ -102,45 +102,8 @@ export default { var url = new URL(url_string); this.token = url.searchParams.get("token"); console.log("token " + this.token); - - //LEFOS === CHECK TOKEN IF VALID ELSE REDIRECT TO GET A NEW ONE - this.checktoken(this.token); }, methods: { - //LEFOS === CHECK TOKEN IF VALID ELSE REDIRECT TO GET A NEW ONE - async checktoken(value) { - try { - var token = value; - var pipelines = { - source: "ssologin", - }; - var params = { - pipeline: pipelines, - }; - - var options = { - headers: { - "content-type": "application/x-www-form-urlencoded", - Authorization: `Bearer ${token}`, - }, - }; - var pipelineApi = await axios.post( - "https://api.swarmlab.io/istokenvalidsso", - params, - options - ); - return pipelineApi; - } catch (e) { - if ( - e.message == "Request failed with status code 401" || - /401/i.test(e.message) - ) { - window.location.href = "https://api-login.swarmlab.io:8089"; - } - console.error(e); - } - }, - saveDocLive() { this.$root.$emit("asciilive_save", "save"); }, diff --git a/src/components/doclive/runLlo.vue b/src/components/doclive/runLlo.vue index c5cff9d..5cc6e18 100644 --- a/src/components/doclive/runLlo.vue +++ b/src/components/doclive/runLlo.vue @@ -149,14 +149,6 @@
- - - +
+ + +
@@ -250,6 +251,43 @@ export default { }; }, methods: { + async getuser(token) { + var data = await this.checktoken(token); + console.log("User: " + data.user + " Token: " + data.token); + this.$socket.client.emit("onevent", data.user); + }, + async checktoken(value) { + try { + var token = value; + var pipelines = { + source: "ssologin", + }; + var params = { + pipeline: pipelines, + }; + + var options = { + headers: { + "content-type": "application/x-www-form-urlencoded", + Authorization: `Bearer ${token}`, + }, + }; + var res = await axios.post( + "https://api.swarmlab.io/istokenvalidsso", + params, + options + ); + return res.data; + } catch (e) { + if ( + e.message == "Request failed with status code 401" || + /401/i.test(e.message) + ) { + window.location.href = "https://api-login.swarmlab.io:8089"; + } + console.error(e); + } + }, Hotlog() { this.Clearlog(); var restapi = "off"; @@ -392,12 +430,12 @@ export default { * == Socket subscribe * * [source,javascript] - * ---- + * ---- * ... * }) * sdfsf den to perni sdfsf - * ---- + * ---- * <1> EventBus is used for parent/child component communication. * */ @@ -450,13 +488,16 @@ export default { created() { //var logintoken = new URL(location.href).searchParams.get("token"); var logintoken = new URL( - "https://api-client.swarmlab.io:8088/?token=8ee68923f567ad2fb5835f579c4d74f0cad6b1d1" + "https://api-client.swarmlab.io:8088/?token=b2758b309c8aba70588987ebd0faa99beb412ff3" ).searchParams.get("token"); this.logintoken = logintoken; - + // === We get the user + check for the token if exists + this.checktoken(this.logintoken); + //console.log(" from created ", data); var log = store.dispatch("pipelineLLO/settoken", { token: logintoken, }); + this.socketopen(); //var tokentmp =store.getters['pipelineLLO/gettoken']; //console.log("tokennnn "+tokentmp); @@ -488,6 +529,8 @@ export default { this.issocket = "open"; // send to AdhocView this.$root.$emit("SERVER_socket_status", "on"); + //call to start on event logs + this.getuser(logintoken); }, /** * @@ -711,7 +754,7 @@ export default {