Files
habitica/website/client/store/actions.js
T
Matteo Pagliazzi 257e932bc3 Vue Store (#8071)
* vue: use our own store in place of vuex

* vue store: add getters, watcher and use internal vue instance

* vue store: better state getter and credits to Vuex

* vue store: $watch -> watch

* vuex store: pass store to getters and fix typos

* add comments to store, start writing tests

* fix unit tests and add missing ones

* cleanup components, add less folder, fetch tassks

* use Vuex helpers

* pin vuex version

* move semantic-ui theme to assets/less, keep website/build empty but in git

* import helpers from vuex
2016-09-29 13:32:36 +02:00

25 lines
478 B
JavaScript

import Vue from 'vue';
export function setTitle (store, title) {
store.state.title = title;
}
export function fetchUser (store) {
let promise = Vue.http.get('/api/v3/user');
promise.then((response) => {
store.state.user = response.body.data;
});
return promise;
}
export function fetchUserTasks (store) {
let promise = Vue.http.get('/api/v3/tasks/user');
promise.then((response) => {
store.state.tasks = response.body.data;
});
return promise;
}