Fix typescript errors
This commit is contained in:
parent
1af69b047d
commit
cd0b370b50
@ -2,7 +2,7 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import { createPinia, SubscriptionCallbackMutation } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import { useBudgetsStore } from './stores/budget';
|
import { useBudgetsStore } from './stores/budget';
|
||||||
import { useAccountStore } from './stores/budget-account'
|
import { useAccountStore } from './stores/budget-account'
|
||||||
import PiniaLogger from './pinia-logger'
|
import PiniaLogger from './pinia-logger'
|
||||||
|
@ -1,61 +1,66 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { mapState } from "pinia";
|
import { mapState } from "pinia";
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent, PropType } from "vue";
|
||||||
import Currency from "../components/Currency.vue";
|
import Currency from "../components/Currency.vue";
|
||||||
import { useBudgetsStore } from "../stores/budget";
|
import { useBudgetsStore } from "../stores/budget";
|
||||||
import { Category, useAccountStore } from "../stores/budget-account";
|
import { Category, useAccountStore } from "../stores/budget-account";
|
||||||
|
|
||||||
interface Date {
|
interface Date {
|
||||||
Year: Number,
|
Year: number,
|
||||||
Month: Number,
|
Month: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
mounted() {
|
props: {
|
||||||
document.title = "Budgeteer - Budget for " + this.selected.Month + "/" + this.selected.Year;
|
budgetid: {} as PropType<string>,
|
||||||
return useAccountStore().FetchMonthBudget(this.budgetid, this.year, this.month);
|
year: {} as PropType<number>,
|
||||||
|
month: {} as PropType<number>,
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
year() {
|
|
||||||
return useAccountStore().FetchMonthBudget(this.budgetid, this.year, this.month);
|
|
||||||
},
|
|
||||||
month() {
|
|
||||||
return useAccountStore().FetchMonthBudget(this.budgetid, this.year, this.month);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
props: ["budgetid", "year", "month"],
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useBudgetsStore, ["CurrentBudgetID"]),
|
...mapState(useBudgetsStore, ["CurrentBudgetID"]),
|
||||||
Categories() : IterableIterator<Category> | undefined {
|
Categories() : Category[] {
|
||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
console.log(accountStore.CategoriesForMonth(this.year, this.month));
|
return [...accountStore.CategoriesForMonth(this.selected.Year, this.selected.Month)];
|
||||||
return accountStore.CategoriesForMonth(this.year, this.month);
|
|
||||||
},
|
},
|
||||||
previous(): Date {
|
previous() : Date {
|
||||||
return {
|
return {
|
||||||
Year: new Date(this.year, this.month - 1, 1).getFullYear(),
|
Year: new Date(this.selected.Year, this.selected.Month - 1, 1).getFullYear(),
|
||||||
Month: new Date(this.year, this.month - 1, 1).getMonth(),
|
Month: new Date(this.selected.Year, this.selected.Month - 1, 1).getMonth(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
current(): Date {
|
current() : Date {
|
||||||
return {
|
return {
|
||||||
Year: new Date().getFullYear(),
|
Year: new Date().getFullYear(),
|
||||||
Month: new Date().getMonth(),
|
Month: new Date().getMonth(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
selected(): Date {
|
selected() : Date {
|
||||||
return {
|
return {
|
||||||
Year: this.year,
|
Year: this.year ?? this.current.Year,
|
||||||
Month: Number(this.month) + 1
|
Month: Number(this.month ?? this.current.Month) + 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
next(): Date {
|
next() : Date {
|
||||||
return {
|
return {
|
||||||
Year: new Date(this.year, Number(this.month) + 1, 1).getFullYear(),
|
Year: new Date(this.selected.Year, Number(this.month) + 1, 1).getFullYear(),
|
||||||
Month: new Date(this.year, Number(this.month) + 1, 1).getMonth(),
|
Month: new Date(this.selected.Year, Number(this.month) + 1, 1).getMonth(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() : Promise<void> {
|
||||||
|
document.title = "Budgeteer - Budget for " + this.selected.Month + "/" + this.selected.Year;
|
||||||
|
return useAccountStore().FetchMonthBudget(this.budgetid ?? "", this.selected.Year, this.selected.Month);
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
year() {
|
||||||
|
if (this.year != undefined && this.month != undefined)
|
||||||
|
return useAccountStore().FetchMonthBudget(this.budgetid ?? "", this.year, this.month);
|
||||||
|
},
|
||||||
|
month() {
|
||||||
|
if (this.year != undefined && this.month != undefined)
|
||||||
|
return useAccountStore().FetchMonthBudget(this.budgetid ?? "", this.year, this.month);
|
||||||
|
},
|
||||||
|
},
|
||||||
components: { Currency }
|
components: { Currency }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filesIncomplete() {
|
filesIncomplete() : boolean {
|
||||||
return this.$data.transactionsFile == undefined || this.$data.assignmentsFile == undefined;
|
return this.$data.transactionsFile == undefined || this.$data.assignmentsFile == undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -8,7 +8,7 @@ interface State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useBudgetsStore = defineStore('budget', {
|
export const useBudgetsStore = defineStore('budget', {
|
||||||
state: () => ({
|
state: (): State => ({
|
||||||
CurrentBudgetID: null,
|
CurrentBudgetID: null,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user