admin: Can view team 0/public my.json
This commit is contained in:
parent
298d09f346
commit
9172f36be7
@ -90,7 +90,11 @@ func declareTeamsRoutes(router *gin.RouterGroup) {
|
|||||||
apiTeamsPublicRoutes := router.Group("/teams/:tid")
|
apiTeamsPublicRoutes := router.Group("/teams/:tid")
|
||||||
apiTeamsPublicRoutes.Use(TeamPublicHandler)
|
apiTeamsPublicRoutes.Use(TeamPublicHandler)
|
||||||
apiTeamsPublicRoutes.GET("/my.json", func(c *gin.Context) {
|
apiTeamsPublicRoutes.GET("/my.json", func(c *gin.Context) {
|
||||||
tfile, err := fic.MyJSONTeam(c.MustGet("team").(*fic.Team), true)
|
var team *fic.Team
|
||||||
|
if t, ok := c.Get("team"); ok && t != nil {
|
||||||
|
team = t.(*fic.Team)
|
||||||
|
}
|
||||||
|
tfile, err := fic.MyJSONTeam(team, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Unable to get MyJSONTeam:", err.Error())
|
log.Println("Unable to get MyJSONTeam:", err.Error())
|
||||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."})
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."})
|
||||||
@ -100,7 +104,11 @@ func declareTeamsRoutes(router *gin.RouterGroup) {
|
|||||||
c.JSON(http.StatusOK, tfile)
|
c.JSON(http.StatusOK, tfile)
|
||||||
})
|
})
|
||||||
apiTeamsPublicRoutes.GET("/wait.json", func(c *gin.Context) {
|
apiTeamsPublicRoutes.GET("/wait.json", func(c *gin.Context) {
|
||||||
tfile, err := fic.MyJSONTeam(c.MustGet("team").(*fic.Team), false)
|
var team *fic.Team
|
||||||
|
if t, ok := c.Get("team"); ok && t != nil {
|
||||||
|
team = t.(*fic.Team)
|
||||||
|
}
|
||||||
|
tfile, err := fic.MyJSONTeam(team, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Unable to get MyJSONTeam:", err.Error())
|
log.Println("Unable to get MyJSONTeam:", err.Error())
|
||||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."})
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user