-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from INFP-Study/feature/signupPeristalsis
[FEATURE] E4-S4 ํ์๊ฐ์ ์ ํจ์ฑ ๊ฒ์ฆ ๋ฐ message ์์ #130
- Loading branch information
Showing
6 changed files
with
107 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,49 @@ | ||
import { put } from 'redux-saga/effects'; | ||
import * as authStore from '../store/auth'; | ||
import { SIGN_UP_API } from '../utils/api/auth'; | ||
import { SIGN_IN_API, SIGN_UP_API } from '../utils/api/auth'; | ||
import axios from 'axios'; | ||
import { INNER_ERROR, SIGN_UP_SUCCESS } from '../constants'; | ||
import { INNER_ERROR, SIGN_IN_SUCCESS, SIGN_UP_SUCCESS } from '../constants'; | ||
import { finishLoading, startLoading } from '../store/loding'; | ||
import { notification } from 'antd'; | ||
|
||
// ๋ก๊ทธ์ธ ์ฌ๊ฐ ์์ ์์ | ||
function* signInSaga(action) { | ||
/* let params = new URLSearchParams(); | ||
params.append('email', 'dawwdawdadawdaw'); | ||
params.append('password', '1234'); */ | ||
/* axios | ||
try { | ||
let params = new URLSearchParams(); | ||
params.append('email', '[email protected]'); | ||
params.append('password', '@test1234'); | ||
axios | ||
.post('https://ciat-bakend.choicloudlab.com/api/v1/user/login', params) | ||
.then((response) => { | ||
console.log('Success'); | ||
console.log(response.status); | ||
console.log(response.headers); | ||
}) | ||
.catch((error) => { | ||
console.log('error'); | ||
console.debug('error'); | ||
console.log(error.response.status); | ||
}); */ | ||
}); | ||
} catch (error) { | ||
console.debug(error); | ||
} finally { | ||
yield put(finishLoading(authStore.signInSuccess)); | ||
} | ||
} | ||
|
||
function* signUpSaga(action) { | ||
try { | ||
yield put(startLoading(authStore.signUpSuccess)); | ||
yield put(startLoading(authStore.signUp)); | ||
const { data } = yield axios.post(SIGN_UP_API, action.data); | ||
yield put({ type: authStore.signUpSuccess, payload: data }); | ||
notification.success({ | ||
message: 'CIAT', | ||
description: SIGN_UP_SUCCESS, | ||
}); | ||
|
||
//์์ ์์ | ||
window.location.href = '/'; | ||
setTimeout(() => { | ||
window.location.href = '/'; | ||
}, 1500); | ||
} catch (e) { | ||
// ์ด๋ฉ์ผ ์ค๋ณต ํ์ธ ๋ก์ง ์ถ๊ฐ์์ | ||
alert('์ด๋ฏธ ๋ฑ๋ก๋ ์ด๋ฉ์ผ์ ๋๋ค.'); | ||
|
@@ -55,4 +65,4 @@ function* signUpSaga(action) { | |
} | ||
} | ||
|
||
export { signUpSaga }; | ||
export { signUpSaga, signInSaga }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters