2022-02-05 14:55:57 +00:00
|
|
|
package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2022-02-13 15:49:22 +00:00
|
|
|
"git.jamesravey.me/ravenscroftj/indiescrobble/models"
|
2022-02-19 15:47:25 +00:00
|
|
|
"git.jamesravey.me/ravenscroftj/indiescrobble/services/scrobble"
|
2022-02-05 14:55:57 +00:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Index(c *gin.Context) {
|
2022-02-13 15:49:22 +00:00
|
|
|
|
|
|
|
// this is an authed endpoint so 'user' must be set and if not panicking is fair
|
|
|
|
currentUser, exists := c.Get("user")
|
|
|
|
|
|
|
|
var user *models.BaseUser
|
|
|
|
|
|
|
|
if exists {
|
|
|
|
user = currentUser.(*models.BaseUser)
|
|
|
|
}else{
|
|
|
|
user = nil
|
|
|
|
}
|
|
|
|
|
2022-02-05 14:55:57 +00:00
|
|
|
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
2022-02-13 15:49:22 +00:00
|
|
|
"title": "test",
|
|
|
|
"user": user,
|
2022-02-05 19:59:41 +00:00
|
|
|
"scrobbleTypes": scrobble.ScrobbleTypeNames,
|
2022-02-05 14:55:57 +00:00
|
|
|
})
|
|
|
|
}
|