Browse Source

治疗方案

zhangxc 6 năm trước cách đây
mục cha
commit
b4e71c9cda
1 tập tin đã thay đổi với 15 bổ sung6 xóa
  1. 15 6
      src/store/async-actions/treat.js

+ 15 - 6
src/store/async-actions/treat.js

@@ -47,12 +47,21 @@ export const addDiagnostic = (item) => {
             };
             
             json(url, params).then((data) =>{
-                item.treat = data.data.data.treat
-            
-                return dispatch({
-                    type: ADD_DIAGNOSTIC,
-                    item: item
-                })
+                console.log('data', data)
+                if (data.data.data) {
+                    item.treat = data.data.data.treat
+                    return dispatch({
+                        type: ADD_DIAGNOSTIC,
+                        item: item
+                    })
+                } else {
+                    item.treat = null
+                    return dispatch({
+                        type: ADD_DIAGNOSTIC,
+                        item: item
+                    })
+                }
+                
             }).catch((e) =>{
                 console.log(e)
             })