Kaynağa Gözat

:recycle: using groupings for individual chat view

tags/0.0.1^2
J 3 yıl önce
ebeveyn
işleme
67f9f74816

+ 1
- 1
frontend/src/components/Messages.vue Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 <template lang="pug">
2 2
 .sidebar--messages
3
-  h5.message__title messages from matches
3
+  h5.message__title matches
4 4
   router-link(
5 5
         :to="`/chats/${match.profile.profile_id}`" 
6 6
         v-for='match in matches' 

+ 4
- 4
frontend/src/components/SideBar.vue Dosyayı Görüntüle

@@ -1,11 +1,11 @@
1 1
 <template lang="pug">
2
-aside.sidebar
3
-    p(v-if="profile.isLoggedIn") chans: {{profile.groupings}}
4
-    .temp-control-box
2
+aside.sidebar.w-flex.column.pa8
3
+    Messages(:matches="matches" :pid="pid")
4
+    .spacer
5
+    nav.temp-control-box
5 6
         input(v-model="switchToPID" @keyup.enter="$emit('updatePid', switchToPID)")
6 7
         button(@click="$emit('updatePid', switchToPID)") switch profile
7 8
     
8
-    Messages(:matches="matches" :pid="pid")
9 9
 </template>
10 10
 
11 11
 <script>

+ 9
- 8
frontend/src/views/ChatView.vue Dosyayı Görüntüle

@@ -3,24 +3,25 @@ main.view--chat.f-col.start.w-full
3 3
     header 
4 4
         h2 Chat Page
5 5
  
6
-    article(v-if="!loading && target && profile.isLoggedIn")
6
+    article(v-if="profile.isLoggedIn && target")
7 7
         h3 {{ profile.id }} 
8 8
             span chatting with: {{ target.profile_id }}
9 9
         p subscriptions: {{ profile.chatter.subscriptions }}
10
+        p target: {{ target }}
10 11
     
12
+    p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.tid }} and {{profile.id}}... 
11 13
     p(v-else) Loading...
12 14
 
13 15
     MainNav(@show-sidebar="$emit('show-sidebar')")
14 16
 </template>
15 17
 
16 18
 <script>
17
-import { fetchProfileByProfileId, currentProfile } from '../services'
19
+import { currentProfile } from '../services'
18 20
 
19 21
 export default {
20 22
     name: 'ProfileView',
21 23
     data: () => ({
22
-        loading: true,
23
-        target: {},
24
+        target: null,
24 25
     }),
25 26
     computed: {
26 27
         profile: () => currentProfile,
@@ -36,15 +37,15 @@ export default {
36 37
     },
37 38
     methods: {
38 39
         async loadTargetProfile() {
39
-            this.loading = true
40 40
             try {
41
-                this.target = await fetchProfileByProfileId(
42
-                    this.$route.params.tid,
41
+                const match = this.profile.groupings.find(
42
+                    grouping =>
43
+                        grouping.profile.profile_id == this.$route.params.tid,
43 44
                 )
45
+                this.target = match.profile
44 46
             } catch (err) {
45 47
                 console.error(err)
46 48
             }
47
-            this.loading = false
48 49
         },
49 50
     },
50 51
 }

Loading…
İptal
Kaydet