This commit is contained in:
2022-02-10 16:07:29 +00:00
parent c693625e34
commit 21dcd7837b
8 changed files with 46 additions and 38 deletions

View File

@ -4,6 +4,7 @@ import { defineComponent } from "vue"
import Autocomplete, { Suggestion } from '../components/Autocomplete.vue'
import Currency from "../components/Currency.vue";
import TransactionRow from "../components/TransactionRow.vue";
import { useAPI } from "../stores/api";
import { useAccountStore } from "../stores/budget-account";
import { useSessionStore } from "../stores/session";
@ -25,9 +26,8 @@ export default defineComponent({
methods: {
saveTransaction(e : MouseEvent) {
e.preventDefault();
fetch("/api/v1/transaction/new", {
method: "POST",
body: JSON.stringify({
const api = useAPI();
api.POST("/transaction/new", JSON.stringify({
budget_id: this.budgetid,
account_id: this.accountid,
date: this.$data.TransactionDate,
@ -36,9 +36,7 @@ export default defineComponent({
memo: this.$data.Memo,
amount: this.$data.Amount,
state: "Uncleared"
}),
headers: useSessionStore().AuthHeaders,
})
}))
.then(x => x.json());
},
}