|
@@ -1,3 +1,25 @@
|
|
|
-export default function* () {
|
|
|
-
|
|
|
+import { put, call } from 'redux-saga/effects';
|
|
|
+import axios from 'axios';
|
|
|
+
|
|
|
+import { SIGN_UP_URL } from './../../constants/auth';
|
|
|
+import { signUpSuccess, signUpFailure } from './../../actions/auth/signUp';
|
|
|
+
|
|
|
+export default function* ({payload}) {
|
|
|
+ try {
|
|
|
+ const config = {
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const report = yield call(() =>
|
|
|
+ axios.post(SIGN_UP_URL, payload, config)
|
|
|
+ .then(({ data }) => data)
|
|
|
+ )
|
|
|
+
|
|
|
+ yield put(signUpSuccess(report));
|
|
|
+ }
|
|
|
+ catch ({ message }) {
|
|
|
+ yield put(signUpFailure(message));
|
|
|
+ }
|
|
|
}
|