Moving the behaviour to types too

This commit is contained in:
2025-07-28 22:59:34 +01:00
parent 5261ba3ea3
commit ef21189d6c
6 changed files with 52 additions and 57 deletions
+8 -1
View File
@@ -39,6 +39,11 @@ func typePage(c *gin.Context) {
typ, err := expenses.GetType(typeID)
if err != nil {
ServerErrorView(c, "failed to retrieve requested type")
return
}
if typ.TypeID == -1 {
NotFoundView(c, fmt.Sprintf("Couldn't find type `%d`", typeID))
return
}
c.HTML(http.StatusOK, "terminal", gin.H{
@@ -46,6 +51,7 @@ func typePage(c *gin.Context) {
"renderNavBar": false,
"content": "type",
"type": typ,
"method": "put",
})
}
@@ -53,7 +59,8 @@ func newTypePage(c *gin.Context) {
c.HTML(http.StatusOK, "terminal", gin.H{
"page": "typeNew",
"renderNavBar": false,
"content": "typeNew",
"content": "type",
"method": "post",
})
}