| | |
| | | |
| | | // register |
| | | const onSubmit = (params) => { |
| | | // console.log(params); |
| | | setLoading(true); |
| | | register(params).then(res => { |
| | | setLoading(false); |
| | | const { code, msg, data } = res; |
| | | if (code === 200) { |
| | | console.log(data); |
| | | notify(msg, { type: 'success', messageArgs: { _: msg } }); |
| | | // to login |
| | | login( |
| | | params, |
| | | location.state ? (location.state).nextPathname : '/' |
| | | ).catch(({ code, msg }) => { |
| | | setLoading(false); |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | }); |
| | | } else if (code === 10002) { |
| | | setError("username", { |
| | | message: msg |