cookie fix

This commit is contained in:
Arnas Udovic 2023-12-30 00:41:53 +02:00
parent 2a18c27c02
commit 1ebc5a7b62

10
main.go
View file

@ -107,7 +107,13 @@ func main() {
func getLang(c *gin.Context) string { func getLang(c *gin.Context) string {
session := sessions.Default(c) session := sessions.Default(c)
lang := session.Get("lang").(string) lang := session.Get("lang")
if lang == nil {
lang = ""
} else {
lang = lang.(string)
}
pLang, hasParam := c.Params.Get("lang") pLang, hasParam := c.Params.Get("lang")
if hasParam && pLang != lang { if hasParam && pLang != lang {
lang = pLang lang = pLang
@ -121,7 +127,7 @@ func getLang(c *gin.Context) string {
session.Save() session.Save()
} }
return lang return lang.(string)
} }
func getGameFlow(c *gin.Context) (string, int) { func getGameFlow(c *gin.Context) (string, int) {