我正在尝试从我的应用程序中注销用户,我有一个按钮侦听单击事件以执行注销算法,该算法类似于下面的代码,但是我只看到了旋转轮,什么也没有。
export const logout = async () => {
try {
const res = await axios({
method: "GET",
url: "http://localhost:3001/users/logout",
});
console.log(res)
if ((res.data.status === "success")) {
window.setTimeout(() => {
location.reload(true);
}, 1000)
}
} catch (err) {
showAlert("error", "Error!! Logging out ! Please Try Again");
}
};
Console.log 按预期返回所有内容 --- Console Result