cookie fix
This commit is contained in:
parent
2a18c27c02
commit
1ebc5a7b62
1 changed files with 8 additions and 2 deletions
10
main.go
10
main.go
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue