fix: register flow

This commit is contained in:
Hasta Ragil Saputra
2019-01-31 19:31:49 +07:00
parent 2087b2d567
commit 8935bca9b0
4 changed files with 134 additions and 10 deletions

View File

@@ -139,6 +139,7 @@ class RegisterPage extends React.Component {
}
this.setState({ isLoading: true });
let data = {
fullname: this.state.full_name,
email: this.state.email,
@@ -157,10 +158,14 @@ class RegisterPage extends React.Component {
additional_data: {}
};
this.authStore.register(data).then(res => {
message.success("Please check your email to confirm your account");
// message.success("Please check your email to confirm your account");
setTimeout(() => {
this.setState({ isLoading: false });
this.props.history.push(LINKS.LOGIN);
this.props.history.push(LINKS.REGISTER_COMPLETED);
// this.props.history.push(LINKS.LOGIN);
}, 250);
}).catch(err => {
this.setState({ isLoading: false });
@@ -214,11 +219,11 @@ class RegisterPage extends React.Component {
name: 'file',
multiple: false,
action: appConfig.apiUrl + 'upload',
customRequest: ({file, onProgress}) => {
customRequest: ({file, onProgress, onSuccess}) => {
this.setState({
uploading: true
});
return this.http.upload(file)
this.http.upload(file)
.then(res => {
this.setState({
[`upload_${key}`]: appConfig.apiUrl + res.path.slice(1,res.path.length)
@@ -236,7 +241,7 @@ class RegisterPage extends React.Component {
fileList[selectedIndex].status = "done";
fileList[selectedIndex].path = res.path;
onSuccess(fileList[selectedIndex]);
// form.setFieldsValue({path: res.path});
this.setState({
@@ -245,6 +250,10 @@ class RegisterPage extends React.Component {
[`fileList_${key}`]: [fileList[selectedIndex]]
});
});
return {
abort: () => {}
}
},
fileList: this.state[`fileList_${key}`],
onChange: (info) => this.uploadOnChange(key, info),