PageRouter.go 287 B

123456789101112131415161718
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. func IndexPage(c *gin.Context) {
  6. cookie, err := c.Cookie("token")
  7. if err != nil || cookie == "" {
  8. c.HTML(200, "index.html", gin.H{
  9. "type": "login",
  10. })
  11. return
  12. }
  13. c.HTML(200, "index.html", gin.H{
  14. "type": "other",
  15. })
  16. }