Преглед на файлове

resetting messges factory after ssh login

tags/0.0.1^2
K Rob преди 3 години
родител
ревизия
7d36300034
променени са 2 файла, в които са добавени 9 реда и са изтрити 32 реда
  1. 9
    23
      frontend/src/services/chat.service.js
  2. 0
    9
      frontend/src/views/HomeView.vue

+ 9
- 23
frontend/src/services/chat.service.js Целия файл

@@ -13,18 +13,6 @@ const providerMethods = {
13 13
     subscribe: () => console.error('no provider subscribe method set'),
14 14
     listen: () => console.error('no provider listen method set'),
15 15
 }
16
-
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('notification for successful sent message'),
24
-    received: (e) => console.log('notification for received message', e.message),
25
-    error: () => console.log('notification for failed message'),
26
-}
27
-
28 16
 /**
29 17
  * 
30 18
  * 
@@ -49,16 +37,11 @@ const setupPubnub = async uuid => {
49 37
     return pubnubClient
50 38
 }
51 39
 
52
-// class ChatMessage {
53
-//     constructor({ title, description }) {
54
-//         ;(this.title = title), (this.description = description)
55
-//     }
56
-// }
57
-
58
-// const testMessage = new ChatMessage({
59
-//     title: 'testing',
60
-//     description: 'hello world!',
61
-// })
40
+class ChatMessage {
41
+    constructor(message) {
42
+        this.description = message
43
+    }
44
+}
62 45
 const MAIN_CHANNEL = 'Channel-Siimee'
63 46
 
64 47
 /** Singleton that holds all our chat information */
@@ -114,7 +97,10 @@ class Chatter {
114 97
      */
115 98
     async publish(channel, message) {
116 99
         // console.log('publishing message to channel:', channel)
117
-        return providerMethods.publish({ channel, message })
100
+        return providerMethods.publish({ 
101
+            channel,
102
+            message: new ChatMessage(message)
103
+        })
118 104
     }
119 105
     /**
120 106
      * Subscribe to a channels

+ 0
- 9
frontend/src/views/HomeView.vue Целия файл

@@ -12,15 +12,6 @@ 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
-<<<<<<< HEAD
16
-    <w-flex class="wrap">
17
-    <w-button @click="notify" bg-color="success"> notify </w-button>
18
-      <w-button @click="chat" bg-color="error"> chat </w-button>
19
-    </w-flex> 
20
-=======
21
-    <w-button @click="notify" bg-color="success"> notify </w-button>
22
-    
23
->>>>>>> da796e1 (setting up messageFactory)
24 15
 </template>
25 16
 
26 17
 <script>

Loading…
Отказ
Запис