Skip to content

Commit d44d31e

Browse files
authored
Merge pull request #130 from guanweiwang/main
fix: auth 登录问题
2 parents cbcf942 + bb14bdb commit d44d31e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

ui/api-templates/http-client.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export enum ContentType {
3838
}
3939

4040

41-
const whitePathnameList = ['/user/login', '/login'];
41+
const whitePathnameList = ['/user/login', '/login', '/auth'];
4242
const whiteApiList = ['/api/v1/user/profile', '/api/v1/admin/profile'];
4343

4444
const redirectToLogin = () => {

ui/src/api/httpClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export enum ContentType {
5858
Text = "text/plain",
5959
}
6060

61-
const whitePathnameList = ["/user/login", "/login"];
61+
const whitePathnameList = ["/user/login", "/login", "/auth"];
6262
const whiteApiList = ["/api/v1/user/profile", "/api/v1/admin/profile"];
6363

6464
const redirectToLogin = () => {

ui/src/main.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ const App = () => {
4545
.finally(() => {
4646
setLoading(false);
4747
});
48-
} else {
48+
} else if (!location.pathname.startsWith('/auth')) {
4949
return getAdminProfile()
5050
.then((res) => {
51-
console.log(res);
5251
setUser(res);
5352
if (location.pathname.startsWith('/login')) {
5453
onGotoRedirect('admin');
@@ -57,6 +56,8 @@ const App = () => {
5756
.finally(() => {
5857
setLoading(false);
5958
});
59+
} else {
60+
setLoading(false);
6061
}
6162
};
6263

0 commit comments

Comments
 (0)