mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
update restful api
This commit is contained in:
10
api/utils.go
10
api/utils.go
@ -4,8 +4,18 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Response struct {
|
||||
Succeed bool `json:"succeed"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
func GetUserIdInCookie(r *http.Request) (string, error) {
|
||||
userIdCookie, err := r.Cookie("user_id")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return userIdCookie.Value, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user