Feature/about api (#253)

* fix settings

* app info cleanup

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-04-02 11:02:01 -08:00
committed by GitHub
parent fd21777990
commit bc595d5cfa
7 changed files with 38 additions and 23 deletions

View File

@@ -28,6 +28,10 @@ const store = new Vuex.Store({
mealPlanCategories: [],
allCategories: [],
allTags: [],
appInfo: {
version: "",
demoStatus: false,
},
},
mutations: {
@@ -43,6 +47,9 @@ const store = new Vuex.Store({
setAllTags(state, payload) {
state.allTags = payload;
},
setAppInfo(state, payload) {
state.appInfo = payload;
},
},
actions: {
@@ -67,6 +74,11 @@ const store = new Vuex.Store({
const tags = await api.tags.getAll();
commit("setAllTags", tags);
},
async requestAppInfo({ commit }) {
const response = await api.meta.getAppInfo();
commit("setAppInfo", response);
},
},
getters: {
@@ -76,6 +88,7 @@ const store = new Vuex.Store({
state.allCategories.sort((a, b) => (a.slug > b.slug ? 1 : -1)),
getAllTags: state =>
state.allTags.sort((a, b) => (a.slug > b.slug ? 1 : -1)),
getAppInfo: state => state.appInfo,
},
});