chore: fix user state loader

This commit is contained in:
Steven
2023-09-15 09:10:16 +08:00
parent 28a1888163
commit e65282dcc5
2 changed files with 6 additions and 6 deletions

View File

@ -67,8 +67,6 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
return next(c) return next(c)
} }
println("path", path)
// Skip validation for server status endpoints. // 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 { 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) return next(c)

View File

@ -34,14 +34,16 @@ const initialGlobalStateLoader = (() => {
})(); })();
const userStateLoader = async () => { const userStateLoader = async () => {
let user = undefined;
try { try {
const user = await initialUserState(); user = await initialUserState();
if (!user) {
return redirect("/explore");
}
} catch (error) { } catch (error) {
// do nothing. // do nothing.
} }
if (!user) {
return redirect("/explore");
}
return null; return null;
}; };