Extract loading of accounts to middleware
This commit is contained in:
17
http/http.go
17
http/http.go
@ -46,15 +46,16 @@ func (h *Handler) Serve() {
|
||||
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index.html", nil) })
|
||||
router.GET("/login", h.login)
|
||||
router.GET("/register", h.register)
|
||||
authenticatedFrontend := router.Group("")
|
||||
withBudget := router.Group("")
|
||||
{
|
||||
authenticatedFrontend.Use(h.verifyLoginWithRedirect)
|
||||
authenticatedFrontend.GET("/dashboard", h.dashboard)
|
||||
authenticatedFrontend.GET("/budget/:budgetid", h.budget)
|
||||
authenticatedFrontend.GET("/budget/:budgetid/accounts", h.accounts)
|
||||
authenticatedFrontend.GET("/account/:accountid", h.account)
|
||||
authenticatedFrontend.GET("/admin", h.admin)
|
||||
authenticatedFrontend.GET("/admin/clear-database", h.clearDatabase)
|
||||
withBudget.Use(h.verifyLoginWithRedirect)
|
||||
withBudget.Use(h.getImportantData)
|
||||
withBudget.GET("/dashboard", h.dashboard)
|
||||
withBudget.GET("/budget/:budgetid", h.budget)
|
||||
withBudget.GET("/budget/:budgetid/accounts", h.accounts)
|
||||
withBudget.GET("/account/:accountid", h.account)
|
||||
withBudget.GET("/admin", h.admin)
|
||||
withBudget.GET("/admin/clear-database", h.clearDatabase)
|
||||
}
|
||||
api := router.Group("/api/v1")
|
||||
{
|
||||
|
Reference in New Issue
Block a user