Johann Woelper před 7 roky
rodič
revize
8c209a8ba0
2 změnil soubory, kde provedl 23 přidání a 6 odebrání
  1. 19 4
      webapp/app.js
  2. 4 2
      webapp/index.html

+ 19 - 4
webapp/app.js

@@ -19,7 +19,7 @@ function log() {
 var app = new Vue({
 var app = new Vue({
     el: '#app',
     el: '#app',
     data: {
     data: {
-        title: "GUNTRADER",
+        title: "guntrader",
         queries: {},
         queries: {},
         debug: false,
         debug: false,
         account: false,
         account: false,
@@ -36,13 +36,18 @@ var app = new Vue({
 
 
     mounted: function () {
     mounted: function () {
         // hide splash
         // hide splash
+        var self = this;
         var splash = document.getElementById("splash");
         var splash = document.getElementById("splash");
         splash.style.display = "none";
         splash.style.display = "none";
         // unhide main container after mount
         // unhide main container after mount
         this.$el.style.display = "block";
         this.$el.style.display = "block";
-        this.account = window.location.hash.slice(1)
-        // get_items();
-        this.load_account();
+
+        this.update();
+
+        window.addEventListener('hashchange', function() {
+            self.update()
+
+        }, false);
 
 
     },
     },
     computed: {
     computed: {
@@ -67,6 +72,16 @@ var app = new Vue({
     },
     },
     
     
     methods: {
     methods: {
+        update: function () {
+            this.account = window.location.hash.slice(1)
+            if (this.account) {
+                console.log(this.account);
+                this.load_account();
+
+            }
+            
+        
+        },
         load_account: function () {
         load_account: function () {
             var self = this;
             var self = this;
             fetch('load/' + self.account)
             fetch('load/' + self.account)

+ 4 - 2
webapp/index.html

@@ -44,6 +44,7 @@
       <input id="nav-toggle" type="checkbox">
       <input id="nav-toggle" type="checkbox">
       <div id="nav-items">
       <div id="nav-items">
           <button @click="search_visible = !search_visible">Sucheinstellungen</button>
           <button @click="search_visible = !search_visible">Sucheinstellungen</button>
+          <button @click="window.location.hash = ''; window.location.reload()">Logout</button>
 
 
         </div>
         </div>
 
 
@@ -127,13 +128,14 @@
         </div>
         </div>
       </div>
       </div>
 
 
+      
       <template>
       <template>
         <div class="panel" v-if="!account">
         <div class="panel" v-if="!account">
           {{account}}
           {{account}}
           Hi! Du hast noch keinen Account oder es ist keiner geladen. Macht aber nichts, gib einfach Deinen ein oder
           Hi! Du hast noch keinen Account oder es ist keiner geladen. Macht aber nichts, gib einfach Deinen ein oder
           denke Dir einen aus.
           denke Dir einen aus.
-          <input v-model="new_account">
-          <button @click="account=new_account; window.location.hash = new_account; load_account()">OK</button>
+          <input v-model="new_account" v-on:keyup.enter="window.location.hash = new_account;">
+          <button @click="window.location.hash = new_account">OK</button>
         </div>
         </div>
 
 
       </template>
       </template>