mirror of
https://github.com/usememos/memos.git
synced 2025-02-25 13:54:32 +08:00
chore: fix user state loader
This commit is contained in:
parent
28a1888163
commit
e65282dcc5
2 changed files with 6 additions and 6 deletions
|
@ -67,8 +67,6 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
|
|||
return next(c)
|
||||
}
|
||||
|
||||
println("path", path)
|
||||
|
||||
// Skip validation for server status endpoints.
|
||||
if util.HasPrefixes(path, "/api/v1/ping", "/api/v1/idp", "/api/v1/status", "/api/v1/user") && path != "/api/v1/user/me" && method == http.MethodGet {
|
||||
return next(c)
|
||||
|
|
|
@ -34,14 +34,16 @@ const initialGlobalStateLoader = (() => {
|
|||
})();
|
||||
|
||||
const userStateLoader = async () => {
|
||||
let user = undefined;
|
||||
try {
|
||||
const user = await initialUserState();
|
||||
if (!user) {
|
||||
return redirect("/explore");
|
||||
}
|
||||
user = await initialUserState();
|
||||
} catch (error) {
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return redirect("/explore");
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue