Connect React workspace to backend data
This commit is contained in:
@@ -11,6 +11,11 @@ const CurrentUserIDKey = "currentUserID"
|
||||
|
||||
func RequireUser(tokenVerifier func(string) (uint, error)) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
if c.Request.Method == http.MethodPost && c.Request.URL.Path == "/api/auth/login" {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
header := c.GetHeader("Authorization")
|
||||
token := strings.TrimPrefix(header, "Bearer ")
|
||||
if token == "" || token == header {
|
||||
|
||||
Reference in New Issue
Block a user