use Vue.delete to update store

This commit is contained in:
hay-kot 2021-05-01 15:56:14 -08:00
commit beed0de6ce

View file

@ -1,4 +1,5 @@
import { api } from "@/api"; import { api } from "@/api";
import Vue from "vue";
const state = { const state = {
recentRecipes: [], recentRecipes: [],
@ -16,7 +17,7 @@ const mutations = {
}, },
dropRecentRecipes(state, payload) { dropRecentRecipes(state, payload) {
if (state.recentRecipes[payload.id]) { if (state.recentRecipes[payload.id]) {
delete state.recentRecipes[payload.id]; Vue.delete(state.recentRecipes, payload.id);
} }
}, },
setAllRecipes(state, payload) { setAllRecipes(state, payload) {
@ -27,7 +28,7 @@ const mutations = {
}, },
dropAllRecipes(state, payload) { dropAllRecipes(state, payload) {
if (state.allRecipes[payload.id]) { if (state.allRecipes[payload.id]) {
delete state.allRecipes[payload.id]; Vue.delete(state.allRecipes, payload.id);
} }
}, },
}; };