Selaa lähdekoodia

:recycle: move user swap to sidebar

tags/0.0.1
J 4 vuotta sitten
vanhempi
commit
7a2dc84082
2 muutettua tiedostoa jossa 15 lisäystä ja 16 poistoa
  1. 10
    3
      frontend/src/components/Sidebar.vue
  2. 5
    13
      frontend/src/views/home.vue

+ 10
- 3
frontend/src/components/Sidebar.vue Näytä tiedosto

@@ -1,12 +1,16 @@
1 1
 <template lang="pug">
2
-
3
-aside.sidebar.p-1
2
+aside.sidebar.p-1.f-col.between
4 3
     h3 Messages
5 4
     .search
6 5
         input
7 6
         label search
8 7
 
9 8
     messages(:title="title" :users="users")
9
+    .spacer.f-grow
10
+    .temp-control-box.f-row.start.center
11
+        p.t-up.p-0 current user
12
+        input(v-model='mypid' style="width: 50px")
13
+        button(@click="$emit('updatePid', mypid)").t-up.p-0 switch
10 14
 </template>
11 15
 
12 16
 <script>
@@ -16,7 +20,7 @@ export default {
16 20
     components: { messages }, 
17 21
     data: () => ({
18 22
         title:'Messages from Matches',
19
-        uid: 111,
23
+        mypid: 45,
20 24
         users: [
21 25
             {
22 26
                 name: 'Bob McRob',
@@ -32,6 +36,9 @@ export default {
32 36
             },
33 37
         ],
34 38
     }),
39
+    created() {
40
+        this.$emit('updatePid', this.mypid)
41
+    }
35 42
 }
36 43
 </script>
37 44
 

+ 5
- 13
frontend/src/views/home.vue Näytä tiedosto

@@ -1,11 +1,9 @@
1 1
 <template lang="pug">
2
-sidebar
2
+sidebar(@updatePid="setPid")
3 3
 main.f-col.start.w-full
4 4
     article#home(v-if='!loading')
5 5
         h1(v-if='user') {{ user.user_name }}
6 6
         profile-card-list(:profiles='swipables' :pid='parseInt(mypid)' @reloadQueue='getQueue')
7
-        input(v-model='mypid')
8
-        button(@click='getQueue') Submit
9 7
     p(v-else) Loading...
10 8
     main-nav
11 9
 </template>
@@ -29,14 +27,11 @@ export default {
29 27
         mypid: null,
30 28
         loading: true
31 29
     }),
32
-    async created() {
33
-        // this.mypid = auth.currentUser?.mypid || "99999";
34
-        this.mypid = 45
35
-        // Uncomment below to use for batch file data
36
-        // this.processProfilesFromBatch(this.parseBatch([batch_10, batch_20, batch_30]))
37
-        this.getQueue()
38
-    },
39 30
     methods: {
31
+        setPid(pid) {
32
+            this.mypid = pid
33
+            this.getQueue()
34
+        },
40 35
         async getQueue() {
41 36
             this.loading = true
42 37
             const queueList = await fetchQueueByProfileId(this.mypid)
@@ -53,8 +48,6 @@ export default {
53 48
                     }
54 49
                 formattedList.push(formatted)
55 50
             })
56
-            console.log('formattedList', formattedList)
57
-            // formattedList.reverse()
58 51
             this.swipables = formattedList
59 52
         },
60 53
         // For Batch Data Parsing & Processing
@@ -93,7 +86,6 @@ export default {
93 86
                 })
94 87
                 this.swipables.push(p)
95 88
             })
96
-            console.log('swipables', this.swipables)
97 89
         },
98 90
     },
99 91
 }

Loading…
Peruuta
Tallenna