Skip to content

Commit

Permalink
perf: check user service is alive then check auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Jan 24, 2023
1 parent 621802e commit 3fca2d2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ function App() {
});
navigate(jump("/status"));
}
return;
})
.then(() => {
apiClient("/user/check")
apiClient("/user/ping").then(() => {
apiClient("/user/check")
.then(() => {
(window.location.pathname == jump("/") ||
window.location.pathname == jump("/login") ||
Expand All @@ -38,11 +40,22 @@ function App() {
app.showSidebar = true;
})
.catch(() => {
console.log(11)
window.location.pathname != jump("/login") &&
window.location.pathname != jump("/register") &&
window.location.pathname != jump("/status") &&
navigate(jump("/login"));
});
}).catch(() => {
if (window.location.pathname != jump("/status")) {
Twindow({
title: "通信错误 - 跳转服务状态页",
text: "无法与用户服务通信,请检查服务状态",
});
navigate(jump("/status"));
}
return;
})
apiClient("/category").then((res) => {
server.categories = res.data;
});
Expand Down

0 comments on commit 3fca2d2

Please sign in to comment.