Browse Source

setting up messageFactory

tags/0.0.1^2
K Rob 3 years ago
parent
commit
5e90c7f2c2
2 changed files with 30 additions and 1 deletions
  1. 14
    0
      frontend/src/services/chat.service.js
  2. 16
    1
      frontend/src/views/HomeView.vue

+ 14
- 0
frontend/src/services/chat.service.js View File

@@ -15,6 +15,19 @@ const providerMethods = {
15 15
 }
16 16
 
17 17
 /**
18
+ * Message factory
19
+ * simple message object creator
20
+ * to notify the frontend ui of a new message
21
+ */
22
+const messageFactory = {
23
+    success: () => console.log('success message for sent message'),
24
+    received: (e) => console.log('received message for received message', e),
25
+    error: () => console.log('error message for failed message'),
26
+}
27
+
28
+/**
29
+ * 
30
+ * 
18 31
  * Breaking out as much pubnub specific flavor
19 32
  */
20 33
 const setupPubnub = async uuid => {
@@ -129,6 +142,7 @@ class Chatter {
129 142
         this.subscriptions = [MAIN_CHANNEL]
130 143
         console.warn('chatter stop no implemented')
131 144
     }
145
+
132 146
 }
133 147
 
134 148
 export { Chatter }

+ 16
- 1
frontend/src/views/HomeView.vue View File

@@ -12,10 +12,12 @@ main.view--home(style="display:flex; flex-direction:column; gap: 40px; margin-to
12 12
     
13 13
     p(v-else-if="matches.length===0") No matches.
14 14
     p(v-else) Loading...
15
-
15
+    <w-button @click="notify" bg-color="success"> notify </w-button>
16
+    
16 17
 </template>
17 18
 
18 19
 <script>
20
+    import 'wave-ui/dist/wave-ui.css'
19 21
 import ProfileCardList from '../components/ProfileCardList.vue'
20 22
 
21 23
 import { Card } from '../entities'
@@ -69,6 +71,19 @@ export default {
69 71
             }
70 72
             this.loading = false
71 73
         },
74
+        notify() {
75
+            this.$waveui.notify({
76
+            message: 'New Message',
77
+            timeout: 6000,
78
+            bgColor: 'white',
79
+            color: 'success',
80
+            dismiss: false,
81
+            shadow: true,
82
+            round: true,
83
+            sm: true,
84
+            icon: 'wi-star'
85
+        })
86
+        },
72 87
     },
73 88
 }
74 89
 </script>

Loading…
Cancel
Save