所以我有一个我想悬而未决的代码,但是我却没有得到这个代码:承诺{}
useEffect(() => {
handleAuthorizationHeader();
let fired = "no";
const fetching = async () => {
try {
const response = await Axios.get("/api/admin/current");
setUser(response.data.userr);
} catch (e) {
setUser(null);
} finally {
fired = "yes";
}
};
if (fired === "no") throw fetching();
}, []);
根据我的理解,我需要在给定条件的情况下作出承诺。为什么我得到错误?悬念后如何设置上下文?