Handle LOGIN via action
This commit is contained in:
@ -62,11 +62,10 @@ const store = createStore({
|
||||
},
|
||||
actions: {
|
||||
[LOGIN]({state, commit}, login) {
|
||||
fetch("/api/v1/user/login", {method: "POST", body: JSON.stringify(login)})
|
||||
return fetch("/api/v1/user/login", {method: "POST", body: JSON.stringify(login)})
|
||||
.then(x => x.json())
|
||||
.then(x => {
|
||||
commit(LOGIN_SUCCESS, x);
|
||||
this.$router.replace("/dashboard");
|
||||
})
|
||||
},
|
||||
YNAB({getters, dispatch}, formData) {
|
||||
@ -148,7 +147,6 @@ const store = createStore({
|
||||
if(state.CurrentBudgetID == null)
|
||||
return {};
|
||||
|
||||
console.log(state.Budgets, state.CurrentBudgetID);
|
||||
const budgets = state.Budgets.filter(x => x.ID == state.CurrentBudgetID);
|
||||
if(budgets.length > 0)
|
||||
return budgets[0];
|
||||
|
Reference in New Issue
Block a user