123456789101112131415161718192021222324252627 |
- import { put, call } from 'redux-saga/effects';
- import axios from 'axios';
- import { SIGN_IN_URL } from './../../constants/auth';
- import { signInSuccess, signInFailure } from './../../actions/auth/signIn'
- export default function* ({payload}) {
- console.log('User inside the worker-saga', payload);
- try {
- const config = {
- headers: {
- "Content-Type": "application/json"
- }
- }
- const user = yield call(() =>
- axios.post(SIGN_IN_URL, payload, config)
- .then(({ data }) => data)
- )
- yield put(signInSuccess(user));
- }
- catch ({ message }) {
- yield put(signInFailure(message));
- }
- }
|