Commit e65282dc authored by Steven's avatar Steven

chore: fix user state loader

parent 28a18881
......@@ -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;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment