这是我的代码:
console.log('call will be made');
const { Status, CallbackUrl } = yield call(fetchUrl, getSsoEndpointUrl(), options);
console.log('call has yielded');
function fetchUrl(url: string, options: RequestInit) {
return fetch(url, options)
.then((response) => {
return response.json();
})
.then((data: SsoServerReponse) => {
console.log('promise resolves', data.data);
return data.data;
});
}
我得到以下日志输出:
sagas.ts call will be made
sagas.ts promise resolves {Status: 200, CallbackUrl: "..."}
我不明白这里可能出什么问题。 fetchUrl
承诺得以解决。为什么console.log('call has yielded')
永远不会发生?
答案 0 :(得分:0)
问题是我在代码的其他地方有以下几行:
yield take(LOCATION_CHANGE);
yield cancel(ssoSignInWatcher);
换句话说,通过阅读我的问题很难猜出这个问题。我正在解决问题。