问题描述
react redux ,使用this.props.dispatch(actions.update)
发起了一个请求,但是没有执行
问题出现的环境背景及自己尝试过哪些方法
界面是一个tab 切换,点击的时候在组件 componentWillMount的时候 调用了this.props.dispatch(actions.fetchALLlevels)
控制台能打印出来 这个action,但是请求没有发送
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
import { ofType } from 'redux-observable';
import { of } from 'rxjs';
import { switchMap, map, catchError } from 'rxjs/operators';
import { ajax } from 'rxjs/ajax';
import * as actions from '../actions/level';
export const fetchAllLevels = action$ =>
action$.pipe(
ofType(actions.fetchAllLevels),
switchMap(() =>
ajax({
url: '/api/v1/rank/get',
method: 'GET',
headers: {
Authorization: localStorage.getItem('token'),
},
}).pipe(
map(data => {
actions.fetchAllLevelsSuccess(data.response)}),
catchError(err => {
toastr.error('获取职级失败');
return of(actions.fetchAllLevelsError(err));
}),
),
),
);
苹果对SSL证书的要求比安卓的要严格,确认一下证书的有效性
——————————————————————
刚碰到同样问题,过来补充一波