Johann Woelper преди 5 години
родител
ревизия
8c209a8ba0
променени са 2 файла, в които са добавени 23 реда и са изтрити 6 реда
  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({
     el: '#app',
     data: {
-        title: "GUNTRADER",
+        title: "guntrader",
         queries: {},
         debug: false,
         account: false,
@@ -36,13 +36,18 @@ var app = new Vue({
 
     mounted: function () {
         // hide splash
+        var self = this;
         var splash = document.getElementById("splash");
         splash.style.display = "none";
         // unhide main container after mount
         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: {
@@ -67,6 +72,16 @@ var app = new Vue({
     },
     
     methods: {
+        update: function () {
+            this.account = window.location.hash.slice(1)
+            if (this.account) {
+                console.log(this.account);
+                this.load_account();
+
+            }
+            
+        
+        },
         load_account: function () {
             var self = this;
             fetch('load/' + self.account)

+ 4 - 2
webapp/index.html

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