This commit is contained in:
Jan Bader 2022-02-09 23:16:16 +00:00
parent 9b8ae7a44d
commit 0c094d6f6b
2 changed files with 3 additions and 18 deletions

View File

@ -1,22 +1,4 @@
import { InjectionKey } from 'vue'
import { createStore, Store, createLogger } from 'vuex'
import { LOGIN_SUCCESS, LOGOUT, TITLE } from './mutation-types'
import { FETCH_ACCOUNT, FETCH_BUDGET, GET, REGISTER, IMPORT_YNAB, LOGIN, NEW_BUDGET, POST, SET_CURRENT_ACCOUNT, SET_CURRENT_BUDGET } from './action-types'
import { budgetStore } from './budget'
import { Budget, useSessionStore } from '../stores/session'
export const key: InjectionKey<Store<State>> = Symbol()
export const store = createStore<State>({
state: {
ShowMenu: undefined,
CurrentBudgetID: undefined,
},
mutations: {
[TITLE](state, title) {
document.title = "Budgeteer - " + title;
},
},
actions: {
[IMPORT_YNAB]({ getters, dispatch }, formData) {
return dispatch("POST", { path: "/budget/" + getters.CurrentBudget.ID + "/import/ynab", body: formData });

View File

@ -51,6 +51,9 @@ export const useSessionStore = defineStore('session', {
}*/
},
actions: {
setTitle(title : string) {
document.title = "Budgeteer - " + title;
},
loginSuccess(x : any) {
this.User = x.User;
this.Token = x.Token;