Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
e65282dc
Commit
e65282dc
authored
Sep 15, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix user state loader
parent
28a18881
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
jwt.go
api/v1/jwt.go
+0
-2
index.tsx
web/src/router/index.tsx
+6
-4
No files found.
api/v1/jwt.go
View file @
e65282dc
...
@@ -67,8 +67,6 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
...
@@ -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
)
...
...
web/src/router/index.tsx
View file @
e65282dc
...
@@ -34,14 +34,16 @@ const initialGlobalStateLoader = (() => {
...
@@ -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
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment