Browse Source

fix error json

dev
xmcp 6 years ago
parent
commit
d2d7390514
  1. 6
      src/UserAction.js
  2. 14
      src/flows_api.js

6
src/UserAction.js

@ -72,7 +72,7 @@ export class LoginForm extends Component {
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
set_token(json.user_token);
@ -226,7 +226,7 @@ export class ReplyForm extends Component {
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
this.setState({
@ -306,7 +306,7 @@ export class PostForm extends Component {
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
this.setState({

14
src/flows_api.js

@ -19,7 +19,7 @@ export const API={
.then((json)=>{
if(json.code!==0) {
if(json.msg) throw new Error(json.msg);
else throw new Error(json);
else throw new Error(JSON.stringify(json));
}
json.data=json.data
@ -54,7 +54,7 @@ export const API={
if(json.msg && json.msg==='已经关注过辣') {}
else {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
}
return json;
@ -77,7 +77,7 @@ export const API={
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
return json;
});
@ -92,7 +92,7 @@ export const API={
.then((res)=>res.json())
.then((json)=>{
if(json.code!==0)
throw new Error(json);
throw new Error(JSON.stringify(json));
return json;
});
},
@ -108,7 +108,7 @@ export const API={
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
return json;
});
@ -124,7 +124,7 @@ export const API={
.then((json)=>{
if(json.code!==0) {
if(json.msg) throw new Error(json.msg);
else throw new Error(json);
else throw new Error(JSON.stringify(json));
}
return json;
});
@ -139,7 +139,7 @@ export const API={
.then((json)=>{
if(json.code!==0) {
if(json.msg) alert(json.msg);
throw new Error(json);
throw new Error(JSON.stringify(json));
}
return json;
});

Loading…
Cancel
Save