Ich habe diese DeleteSkill-Handler. In diesem Handler rufe ich ein API auf, um Fertigkeiten zu löschen. (yield (utils.deleteSkill)). Es ruft die API erfolgreich, aber danach nichts ausführen. Die Konsolenanweisung nach dem Yield-Aufruf gibt nichts aus. Ich kann nichts herausfinden. Kann mir bitte jemand helfen?Redux-Saga wird nicht ausgeführt nach Yield Call
import { takeLatest, delay, takeEvery } from 'redux-saga'
import { call, fork, put, race, take } from 'redux-saga/effects'
import * as ActionTypes from './../constants/actions'
/* Handlers */
function* fetchSkills(action) {
try {
const { data } = yield call(utils.fetchSkills, action)
yield put({type: ActionTypes.SUCCESS_FETCH_SKILLS, data})
} catch (e) {
}
}
function* deleteSkill(action) {
try {
yield call(utils.deleteSkill, action.data) //doesn't execute after this
console.log('Hello') //won't execute
yield put({type: ActionTypes.REQUEST_FETCH_SKILLS})
} catch (e) {}
}
/* Watchers */
function* watchFetchSkills() {
while (true) {
yield* takeLatest(ActionTypes.REQUEST_FETCH_SKILLS, fetchSkills)
}
}
function* watchDeleteSkill() {
while (true) {
yield* takeLatest(ActionTypes.REQUEST_DELETE_SKILL, deleteSkill)
}
}
export default function* rootSaga() {
yield [
fork(watchFetchSkills),
fork(watchDeleteSkill),
]
}
es wäre nützlich, um die 'utils.deleteSkill' Funktion – VonD
' Exportfunktion deleteSkill (data) { return DELETE ({ api zu sehen: '$ {expertsAPI.skills} $ {data} /', handle: true }) .dann (json => json) } ' – madhurgarg
gibt Ihre Konsole eine Warnung aus wie' deleteSkill wurde abgebrochen'? – VonD