Working on login user name state

This commit is contained in:
Torkel Ödegaard
2014-09-17 15:25:07 +02:00
parent ecafc7bf8f
commit 4dfe8b6f69
5 changed files with 38 additions and 12 deletions
+7 -1
View File
@@ -58,7 +58,13 @@ func (self *HttpServer) ListenAndServe() {
}
func (self *HttpServer) index(c *gin.Context) {
c.HTML(200, "index.html", &indexViewModel{title: "hello from go"})
viewModel := &IndexDto{}
login, _ := c.Get("login")
if login != nil {
viewModel.User.Login = login.(string)
}
c.HTML(200, "index.html", viewModel)
}
func CacheHeadersMiddleware() gin.HandlerFunc {