metadata-management (#10)
Co-authored-by: Joe Arndt <jmarndt@users.noreply.github.com> Reviewed-on: #10
This commit is contained in:
parent
598377d8d0
commit
284e1cbef8
49 changed files with 585 additions and 82 deletions
|
|
@ -38,15 +38,16 @@ export class ExpenseComponent {
|
|||
const postExpense: CreateExpense = {
|
||||
date: this.dateToPlainDate(form.date),
|
||||
cents: form.cents,
|
||||
categoryId: form.category.id,
|
||||
note: !!form.note ? form.note : undefined,
|
||||
merchantId: !!form.merchant ? form.merchant.id : undefined,
|
||||
tagIds: form.tags.map(tag => tag.id)
|
||||
category: form.category,
|
||||
merchant: form.merchant,
|
||||
note: form.note,
|
||||
tags: form.tags
|
||||
};
|
||||
this.savingExpense.set(true);
|
||||
const snackId = this.snackBar.staticBar('Tracking new expense...');
|
||||
try {
|
||||
await this.expenseService.postExpense(postExpense);
|
||||
await this.expenseService.create(postExpense);
|
||||
await this.expenseService.fetch();
|
||||
this.resetForm();
|
||||
this.snackBar.dismiss(snackId);
|
||||
this.snackBar.autoBar('Expense tracked!');
|
||||
|
|
@ -70,15 +71,15 @@ export class ExpenseComponent {
|
|||
id: this.expense()!.id,
|
||||
date: this.dateToPlainDate(form.date),
|
||||
cents: form.cents,
|
||||
categoryId: form.category.id,
|
||||
note: !!form.note ? form.note : undefined,
|
||||
merchantId: !!form.merchant ? form.merchant.id : undefined,
|
||||
tagIds: form.tags.map(tag => tag.id)
|
||||
category: form.category,
|
||||
merchant: form.merchant,
|
||||
note: form.note,
|
||||
tags: form.tags
|
||||
};
|
||||
this.savingExpense.set(true);
|
||||
const snackId = this.snackBar.staticBar('Updating expense...');
|
||||
try {
|
||||
const expense = await this.expenseService.updateExpense(putExpense);
|
||||
const expense = await this.expenseService.update(putExpense);
|
||||
this.expense.set(expense);
|
||||
this.form()?.refresh(expense);
|
||||
this.editingExpense.set(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue