const createRequest = (ajaxParameters) => {
return ajax(ajaxParameters).pipe(
takeUntil([ofType("LOGOUT")])
)
};
并且我所有的史诗功能都在导入上述功能以发出HTTP请求。我在做这样的事情
const sendRequest = (url) => {
xhr = createRequest(_.merge({}, requestDefaults, {
method: "GET",
url: url
}, token))
xhr.pipe(
map(
// some code over here and triggering some actions over here
)
)
}
问题是,每当我像上面一样添加takeUntil
时,它都会停止触发所有史诗。知道我在这里做错了什么吗?
史诗代码
const fetchUserData = action$ => action$.pipe(
ofType(user.FETCH_USER_DATA.PENDING),
mergeMap(sendRequest(URL_OVER_HERE))
);
[ofType("LOGOUT")]
在这里做什么,但是最有可能的是,您想要的是pipe
从action$
关闭: