Browse Source

feat: pop out loading modal once register button is clicked

master
kdxcxs 4 years ago
parent
commit
6f2a1c0b1c
  1. 3
      src/Male.js

3
src/Male.js

@ -86,6 +86,7 @@ class Male extends React.Component {
handleClick(program_name) { handleClick(program_name) {
const program_type = '男子'; const program_type = '男子';
this.openModal('加载中', '');
fetch('/register', { fetch('/register', {
method: 'Post', method: 'Post',
body: JSON.stringify({ body: JSON.stringify({
@ -96,8 +97,10 @@ class Male extends React.Component {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (json.result === 'success') { if (json.result === 'success') {
this.handleCloseModal();
this.openModal('成功', '成功报名男子项目' + program_name); this.openModal('成功', '成功报名男子项目' + program_name);
} else { } else {
this.handleCloseModal();
this.openModal('失败', '报名男子项目' + program_name + '时失败'); this.openModal('失败', '报名男子项目' + program_name + '时失败');
} }
}); });

Loading…
Cancel
Save