Skip to content
Snippets Groups Projects
Commit c463dc67 authored by yms's avatar yms
Browse files

feat: 添加提示

parent c8ad7595
Branches
Tags 0.1.0
No related merge requests found
......@@ -12,31 +12,31 @@ const Main = () => {
}, []);
const { loginInfo, user, setUser, setLoginInfo } = useModel("global");
// useEffect(() => {
// try {
// /** 不存在先直接跳转 */
// if (!loginInfo?.token && !window.location.search) {
// window.location.href = `${config.thirdPartyFrontEndPageUrl}/authorizedLogin.html?client_id=OM90JPKW&response_type=code&redirect_uri=${config.devAppUrl}`;
// return;
// }
useEffect(() => {
try {
/** 不存在先直接跳转 */
if (!loginInfo?.token && !window.location.search) {
window.location.href = `${config.thirdPartyFrontEndPageUrl}/authorizedLogin.html?client_id=OM90JPKW&response_type=code&redirect_uri=${config.devAppUrl}`;
return;
}
// if (!loginInfo?.token && window.location.search) {
// const params = new URLSearchParams(window.location.search);
if (!loginInfo?.token && window.location.search) {
const params = new URLSearchParams(window.location.search);
// if (params.get("code")) {
// getToken(params.get("code") as string)
// .then((res) => {
// setLoginInfo(res.data);
// })
// .catch((err) => {
// alert(JSON.stringify(err));
// });
// }
// }
// } catch (error) {
// alert(error);
// }
// }, []);
if (params.get("code")) {
getToken(params.get("code") as string)
.then((res) => {
setLoginInfo(res.data);
})
.catch((err) => {
alert(JSON.stringify(err));
});
}
}
} catch (error) {
alert(error);
}
}, []);
useEffect(() => {
if (!user && loginInfo?.token) {
......
......@@ -109,8 +109,8 @@ const Report = () => {
setLoading(false);
}
});
} catch (error) {
Notify.show({ type: "danger", message: "上报失败!" });
} catch (error: any) {
Notify.show({ type: "danger", message: error });
setLoading(false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment