|
@@ -1,24 +1,21 @@
|
|
|
import { put, call } from "redux-saga/effects";
|
|
|
import * as actions from './../../../actions/auth/signIn'
|
|
|
+import axios from 'axios';
|
|
|
|
|
|
-import { SIGN_IN_URL } from './../../../constants'
|
|
|
|
|
|
// worker-saga for signing in
|
|
|
|
|
|
export default function* ({ payload: requestBody }) {
|
|
|
try {
|
|
|
// console.log('received request body from sign-in worker saga', requestBody);
|
|
|
- const payload = yield call(() =>
|
|
|
- fetch(SIGN_IN_URL, {
|
|
|
- method: 'POST',
|
|
|
- body: JSON.stringify(requestBody)
|
|
|
- })
|
|
|
- .then(res => res.json())
|
|
|
+ const payload = yield call(() =>
|
|
|
+ axios.post(`https://quiz.maxcrc.de/api/v1/user`, {...requestBody})
|
|
|
+ .then(({ data }) => data)
|
|
|
);
|
|
|
// console.log("Payload", payload);
|
|
|
yield put(actions.signInRequestSucces(payload));
|
|
|
}
|
|
|
- catch (exception) {
|
|
|
- yield put(actions.signInRequestFailure(exception.message))
|
|
|
+ catch ({ message }) {
|
|
|
+ yield put(actions.signInRequestFailure(message))
|
|
|
}
|
|
|
}
|