Remove vuex
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue"
|
||||
import { IMPORT_YNAB } from "../store/action-types";
|
||||
import { TITLE } from "../store/mutation-types"
|
||||
import { useAPI } from "../stores/api";
|
||||
import { useBudgetsStore } from "../stores/budget";
|
||||
import { useSessionStore } from "../stores/session";
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
@ -16,7 +17,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.commit(TITLE, "Settings")
|
||||
document.title = "Budgeteer - Settings";
|
||||
},
|
||||
methods: {
|
||||
gotAssignments(e : Event) {
|
||||
@ -30,22 +31,21 @@ export default defineComponent({
|
||||
this.$data.transactionsFile = input.files[0];
|
||||
},
|
||||
deleteBudget() {
|
||||
fetch("/api/v1/budget/" + this.$store.getters.CurrentBudget.ID, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.$store.state.Session.Token
|
||||
},
|
||||
});
|
||||
this.$store.commit("deleteBudget", this.$store.getters.CurrentBudget.ID)
|
||||
const currentBudgetID = useBudgetsStore().CurrentBudgetID;
|
||||
if (currentBudgetID == null)
|
||||
return;
|
||||
|
||||
const api = useAPI();
|
||||
api.DELETE("/api/v1/budget/" + currentBudgetID);
|
||||
|
||||
const budgetStore = useSessionStore();
|
||||
budgetStore.Budgets.delete(currentBudgetID);
|
||||
this.$router.push("/")
|
||||
},
|
||||
clearBudget() {
|
||||
fetch("/api/v1/budget/" + this.$store.getters.CurrentBudget.ID + "/settings/clear", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.$store.state.Session.Token
|
||||
},
|
||||
})
|
||||
const currentBudgetID = useBudgetsStore().CurrentBudgetID;
|
||||
const api = useAPI();
|
||||
api.POST("/api/v1/budget/" + currentBudgetID + "/settings/clear", null)
|
||||
},
|
||||
cleanNegative() {
|
||||
// <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>
|
||||
@ -57,7 +57,8 @@ export default defineComponent({
|
||||
let formData = new FormData();
|
||||
formData.append("transactions", this.$data.transactionsFile);
|
||||
formData.append("assignments", this.$data.assignmentsFile);
|
||||
this.$store.dispatch(IMPORT_YNAB, formData);
|
||||
const budgetStore = useBudgetsStore();
|
||||
budgetStore.ImportYNAB(formData);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user