enrecipes/app/store.js

110 lines
3 KiB
JavaScript
Raw Normal View History

2020-10-14 19:32:32 +00:00
import Vue from "vue"
import Vuex from "vuex"
2020-09-15 11:10:16 +00:00
2020-10-14 19:32:32 +00:00
Vue.use(Vuex)
2020-09-15 11:10:16 +00:00
export default new Vuex.Store({
state: {
// recipes: [],
2020-10-14 19:32:32 +00:00
icon: {
home: "\ued99",
heart: "\ued94",
heartOutline: "\uead6",
label: "\uedaf",
cog: "\ued05",
info: "\ueda7",
menu: "\ueb2a",
search: "\uebbc",
sort: "\ueb2b",
plus: "\ueb89",
close: "\uec4e",
2020-10-21 17:54:45 +00:00
image: "\ueae9",
2020-10-14 19:32:32 +00:00
back: "\ue988",
save: "\uee48",
camera: "\uecc2",
share: "\uee51",
edit: "\uee17",
theme: "\ued09",
folder: "\ued7c",
backup: "\uee48",
restore: "\ueadc",
link: "\ueb09",
file: "\ued60",
user: "\uee8e",
trash: "\uee83",
2020-10-21 17:54:45 +00:00
donate: "\ued41",
musttry: "\uec96",
musttryOutline: "\ue9bb",
2020-10-14 19:32:32 +00:00
},
2020-10-21 17:54:45 +00:00
currentComponent: "EnRecipes",
2020-09-15 11:10:16 +00:00
},
mutations: {
// addRecipe(state, recipe) {
// state.recipes.push(recipe)
// },
// addCategory(state, category) {
// let a = state.categories.filter((e) => e === category).length
// if (a == 0) {
// state.categories.push(category)
// state.categories.sort()
// }
// },
// overwriteRecipe(state, { index, recipe }) {
// Object.assign(state.recipes[index], recipe)
// },
// deleteRecipe(state, index) {
// state.recipes.splice(index, 1)
// },
// toggleFavorite(state, index) {
// state.recipes[index].isFavorite = !state.recipes[index].isFavorite
// },
// toggleMustTry(state, index) {
// state.recipes[index].tried = !state.recipes[index].tried
// },
2020-10-21 17:54:45 +00:00
setCurrentComponent(state, comp) {
state.currentComponent = comp
},
// renameCategory(state, { current, updated }) {
// let a = state.categories.filter((e) => e === updated).length
// if (a == 0) {
// // add updated category to categories
// state.categories.splice(state.categories.indexOf(current), 1)
// state.categories.push(updated)
// state.categories.sort()
// // rename all occurences
// state.recipes.forEach((e, i) => {
// if (e.category == current) {
// state.recipes[i].category = updated
// }
// })
// }
// },
2020-09-15 11:10:16 +00:00
},
actions: {
// addRecipeAction({ commit }, recipe) {
// commit("addRecipe", recipe)
// },
// addCategoryAction({ commit }, category) {
// commit("addCategory", category)
// },
// overwriteRecipeAction({ commit }, updatedRecipe) {
// commit("overwriteRecipe", updatedRecipe)
// },
// deleteRecipeAction({ commit }, index) {
// commit("deleteRecipe", index)
// },
// toggleFavoriteAction({ commit }, index) {
// commit("toggleFavorite", index)
// },
// toggleMustTryAction({ commit }, index) {
// commit("toggleMustTry", index)
// },
2020-10-22 18:36:50 +00:00
setCurrentComponentAction({ commit }, comp) {
2020-10-21 17:54:45 +00:00
commit("setCurrentComponent", comp)
},
// renameCategoryAction({ commit }, category) {
// commit("renameCategory", category)
// },
2020-10-14 19:32:32 +00:00
},
})