Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { call, put, takeEvery, select } from 'redux-saga/effects'
// Services
import { callApi, callServiceApi } from 'services/api'
function* login(action) {
try {
// Set loading state
yield put({
type: 'USER_SET_LOADING',
payload: true
})
const response = yield call(callApi, {
title: 'USER LOGIN',
endpoint: `/login`,
method: 'POST',
data: action.payload
})
console.log('[USER LOGIN RESPONSE]', response)
if (response.status == 200) {
}
} catch ({ message, response }) {
console.warn('[USER LOGIN ERROR]', { message, response })
yield put({
type: 'USER_SET_LOADING',
payload: false
})
}
export default function* rootUser() {
yield takeEvery('USER_LOGIN_TRIGGER', login)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.