Convert frontend to Vue #3
@ -6,24 +6,28 @@ import { TITLE } from "../store/mutation-types"
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
transactionsFile: null,
|
||||
assignmentsFile: null
|
||||
transactionsFile: undefined as File | undefined,
|
||||
assignmentsFile: undefined as File | undefined
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filesIncomplete() {
|
||||
return this.$data.transactionsFile == null || this.$data.assignmentsFile == null;
|
||||
return this.$data.transactionsFile == undefined || this.$data.assignmentsFile == undefined;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.commit(TITLE, "Settings")
|
||||
},
|
||||
methods: {
|
||||
gotAssignments(e) {
|
||||
this.$data.assignmentsFile = e.target.files[0];
|
||||
gotAssignments(e : Event) {
|
||||
const input = (<HTMLInputElement>e.target);
|
||||
if(input.files != null)
|
||||
this.$data.assignmentsFile = input.files[0];
|
||||
},
|
||||
gotTransactions(e) {
|
||||
this.$data.transactionsFile = e.target.files[0];
|
||||
gotTransactions(e : Event) {
|
||||
const input = (<HTMLInputElement>e.target);
|
||||
if(input.files != null)
|
||||
this.$data.transactionsFile = input.files[0];
|
||||
},
|
||||
deleteBudget() {
|
||||
fetch("/api/v1/budget/" + this.$store.getters.CurrentBudget.ID, {
|
||||
@ -47,6 +51,9 @@ export default defineComponent({
|
||||
// <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>
|
||||
},
|
||||
ynabImport() {
|
||||
if (this.$data.transactionsFile == undefined || this.$data.assignmentsFile == undefined)
|
||||
return
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append("transactions", this.$data.transactionsFile);
|
||||
formData.append("assignments", this.$data.assignmentsFile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user