nuxt init

This commit is contained in:
hay-kot
2021-07-31 14:00:28 -08:00
parent 79b3985a49
commit 8d3db89327
275 changed files with 13274 additions and 4003 deletions

View File

@@ -0,0 +1,47 @@
import { api } from "@/api";
import { loadLanguageAsync } from "@/i18n"
const state = {
siteSettings: {
language: "en-US",
firstDayOfWeek: 0,
showRecent: true,
cardsPerSection: 9,
categories: [],
},
customPages: [],
};
const mutations = {
setSettings(state, payload) {
state.siteSettings = payload;
loadLanguageAsync(payload.language);
},
setCustomPages(state, payload) {
state.customPages = payload;
},
};
const actions = {
async requestSiteSettings({ commit }) {
let settings = await api.siteSettings.get();
commit("setSettings", settings);
},
async requestCustomPages({ commit }) {
const customPages = await api.siteSettings.getPages();
commit("setCustomPages", customPages);
},
};
const getters = {
getActiveLang: state => state.siteSettings.language,
getSiteSettings: state => state.siteSettings,
getCustomPages: state => state.customPages,
};
export default {
state,
mutations,
actions,
getters,
};