More work on backend for user favorites
This commit is contained in:
@@ -16,7 +16,7 @@ type AuthOptions struct {
|
||||
}
|
||||
|
||||
func getRequestUserId(c *Context) int64 {
|
||||
userId := c.Session.Get("userId")
|
||||
userId := c.Session.Get(SESS_KEY_USERID)
|
||||
|
||||
if userId != nil {
|
||||
return userId.(int64)
|
||||
@@ -24,8 +24,8 @@ func getRequestUserId(c *Context) int64 {
|
||||
|
||||
// TODO: figure out a way to secure this
|
||||
if c.Query("render") == "1" {
|
||||
userId := c.QueryInt64("userId")
|
||||
c.Session.Set("userId", userId)
|
||||
userId := c.QueryInt64(SESS_KEY_USERID)
|
||||
c.Session.Set(SESS_KEY_USERID, userId)
|
||||
return userId
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package middleware
|
||||
|
||||
const (
|
||||
SESS_KEY_USERID = "uid"
|
||||
SESS_KEY_FAVORITES = "favorites"
|
||||
)
|
||||
Reference in New Issue
Block a user