我在Redux传奇中有以下代码:
function* providersList(action) {
yield put(LoadingActionCreators.start(Actions.PROVIDERS_LIST));
yield put(ErrorActionCreators.clear(Actions.PROVIDERS_LIST));
try {
const response = yield call(
PostRequest,
'providers/list',
{
AuthorizationKey: authorizationKey,
CustomerID: action.customerID
}
);
if (response.Message === "Success")
yield put(ProvidersActionCreators.providersListSuccess(response.Providers))
else
yield put(ErrorActionCreators.set(Actions.PROVIDERS_LIST, new Error('PROVIDERS_LIST ERROR')));
} catch (error) {
yield put(ErrorActionCreators.set(Actions.PROVIDERS_LIST, error));
}
yield put(LoadingActionCreators.end(Actions.PROVIDERS_LIST));
}
我正在使用React Native调试器,并希望在if (response.Message === "Success")
行放置一个断点。调试器不会让我这样做。如果单击此处放置断点,则将其放置在function* providersList(action)
行上方。
任何人都可以帮助我了解这是为什么吗?
以这种方式放置debugger
并从debug
中启用developer menu
并打开console of chrome debugger
。
if (response.Message === "Success"){
debugger // you have to add this line.
yield put(ProvidersActionCreators.providersListSuccess(response.Providers))
}