Преглед изворни кода

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
     subscribe: () => console.error('no provider subscribe method set'),
13
     subscribe: () => console.error('no provider subscribe method set'),
14
     listen: () => console.error('no provider listen method set'),
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
     return pubnubClient
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
 const MAIN_CHANNEL = 'Channel-Siimee'
45
 const MAIN_CHANNEL = 'Channel-Siimee'
63
 
46
 
64
 /** Singleton that holds all our chat information */
47
 /** Singleton that holds all our chat information */
114
      */
97
      */
115
     async publish(channel, message) {
98
     async publish(channel, message) {
116
         // console.log('publishing message to channel:', channel)
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
      * Subscribe to a channels
106
      * Subscribe to a channels

+ 0
- 9
frontend/src/views/HomeView.vue Прегледај датотеку

12
     
12
     
13
     p(v-else-if="matches.length===0") No matches.
13
     p(v-else-if="matches.length===0") No matches.
14
     p(v-else) Loading...
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
 </template>
15
 </template>
25
 
16
 
26
 <script>
17
 <script>

Loading…
Откажи
Сачувај