removed "entered" log, fixed loading symbol, implemented category update with editing

This commit is contained in:
thschleicher 2024-01-05 20:53:47 +01:00
parent 0ddfe3e606
commit 497c556a87
6 changed files with 25 additions and 14 deletions

View file

@ -24,6 +24,18 @@ export const initDatabase = async () => {
}
};
export const updateCategory = async (guid: string, name: string, color: string, type: string, allocated_amount: number) => {
try {
await db.transactionAsync(async (tx) => {
await tx.executeSqlAsync("UPDATE category SET name = ?, color = ?, type = ?, allocated_amount = ? WHERE guid = ?", [name, color, type, allocated_amount, guid]);
});
} catch (error) {
console.log("Error updating category: ", error);
throw error;
}
};
export const addCategory = async (name: string, color: string, type: string, allocated_amount: number) => {
//needs user input validation for type and color (should be validated by this function)