mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: fix user state loader
This commit is contained in:
@ -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)
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user