Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
- const { login } = this.props;
- const { id, password } = this.state;
- e.preventDefault();
- console.log(this.props);
- await login({ id, password }); // redux-saga를 이용해 api 요청을 하는 함수. LOGIN 액션.
- await this.afterLogin(); // 로그인 요청 이후 실행될 함수
- };
- public afterLogin = () => {
- const { history, loginStatus } = this.props;
- console.log(loginStatus); // 로그인 요청 상태
- if (loginStatus === 'success') { // 성공시
- console.log(loginStatus);
- history.push('/');
- } else if (loginStatus === 'failure') { //
- console.log(loginStatus);
- alert('로그인 실패');
- history.push('/');
- }
- console.log(loginStatus);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement