Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix user state loader

Stevene65282dcc52a
diff --git a/api/v1/jwt.go b/api/v1/jwt.go
index 2af4b91f7..29b423d1b 100644
--- a/api/v1/jwt.go
+++ b/api/v1/jwt.go
@@ -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)
diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx
index b8f3d3c2b..5504d1228 100644
--- a/web/src/router/index.tsx
+++ b/web/src/router/index.tsx
@@ -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;
};