Pārlūkot izejas kodu

fixed app slug + fixed app reopening

Skylsmoi 6 gadus atpakaļ
vecāks
revīzija
1c7a2c309a
1 mainītis faili ar 7 papildinājumiem un 5 dzēšanām
  1. 7 5
      src/container/Thread.jsx

+ 7 - 5
src/container/Thread.jsx Parādīt failu

@@ -36,14 +36,16 @@ class Thread extends React.Component {
36 36
     document.addEventListener('appCustomEvent', this.customEventReducer)
37 37
   }
38 38
 
39
-  customEventReducer = ({ detail: action }) => { // action: { type: '', data: {} }
40
-    switch (action.type) {
41
-      case 'Thread_showApp':
39
+  customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
40
+    switch (type) {
41
+      case 'thread_showApp':
42 42
         this.setState({isVisible: true})
43 43
         break
44
-      case 'Thread_hideApp':
44
+      case 'thread_hideApp':
45 45
         this.setState({isVisible: false})
46 46
         break
47
+      case 'thread_reloadContent':
48
+        this.setState(prev => ({content: {...prev.content, ...data}, isVisible: true}))
47 49
     }
48 50
   }
49 51
 
@@ -135,7 +137,7 @@ class Thread extends React.Component {
135 137
 
136 138
     handleFetchResult(await fetchResultSaveEditStatus)
137 139
       .then(resSave => {
138
-        if (resSave.apiResponse.status !== 204) { // 204 no content so dont take status from resSave.apiResponse.status
140
+        if (resSave.status !== 204) { // 204 no content so dont take status from resSave.apiResponse.status
139 141
           console.warn('Error saving thread comment. Result:', resSave, 'content:', content, 'config:', config)
140 142
         } else {
141 143
           this.loadContent()