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