Fix the type by id page
This commit is contained in:
@@ -49,7 +49,7 @@ func GetAllTypes() ([]Type, error) {
|
||||
return typeList, nil
|
||||
}
|
||||
|
||||
func GetType(storeID int) (Type, error) {
|
||||
func GetType(typID int) (Type, error) {
|
||||
db, err := sql.Open("sqlite3", "./data/data.db")
|
||||
if err != nil {
|
||||
return Type{}, err
|
||||
@@ -58,7 +58,7 @@ func GetType(storeID int) (Type, error) {
|
||||
|
||||
query := "SELECT TypeID,TypeName " +
|
||||
"FROM expenseTypes " +
|
||||
"WHERE TypeID = " + strconv.Itoa(storeID)
|
||||
"WHERE TypeID = " + strconv.Itoa(typID)
|
||||
|
||||
var nType Type
|
||||
err = db.QueryRow(query).Scan(&nType.TypeID, &nType.TypeName)
|
||||
|
||||
+2
-2
@@ -60,11 +60,11 @@ func typePage(c *gin.Context) {
|
||||
c.Redirect(404, "/404")
|
||||
}
|
||||
|
||||
typ, err := expenses.GetCategory(typeID)
|
||||
typ, err := expenses.GetType(typeID)
|
||||
content := templating.HtmlTemplate(
|
||||
fp.Join(cfg.AssetsDir, "/htmx/type.html"),
|
||||
map[string]any{
|
||||
"category": typ,
|
||||
"type": typ,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user