Browse Source

fix: show error message

pull/171/head
Aldino Kemal 2 years ago
parent
commit
beaf069618
  1. 25
      src/views/components/AppLoginWithCode.js

25
src/views/components/AppLoginWithCode.js

@ -39,29 +39,20 @@ export default {
if (this.submitting) return; if (this.submitting) return;
try { try {
this.submitting = true; this.submitting = true;
const { data } = await this.submitApi();
this.pair_code = data.results.pair_code;
} catch (err) {
showErrorInfo(err);
} finally {
this.submitting = false;
}
},
async submitApi() {
try {
return http.get(`/app/login-with-code`, {
const { data } = await http.get(`/app/login-with-code`, {
params: { params: {
phone: this.phone, phone: this.phone,
}, },
}); });
} catch (error) {
if (error.response) {
throw Error(error.response.data.message);
this.pair_code = data.results.pair_code;
} catch (err) {
if (err.response) {
return showErrorInfo(err.response.data.message);
} }
throw Error(error.message);
return showErrorInfo(err.message);
} finally {
this.submitting = false;
} }
}, },
}, },
template: ` template: `

Loading…
Cancel
Save