-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6157dc0
commit 61ddfcb
Showing
12 changed files
with
223 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Preparations | ||
|
||
### Оправдание | ||
Код не самый лучший. Делалось все на скорую руку | ||
|
||
### Demo | ||
http://preparations.herokuapp.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Vue from 'vue' | ||
import Vuex from 'vuex' | ||
import createPersistedState from 'vuex-persistedstate' | ||
|
||
import preparationsStore from './preparations' | ||
|
||
Vue.use(Vuex); | ||
const store = new Vuex.Store({ | ||
plugins: [ | ||
createPersistedState() | ||
], | ||
modules: { | ||
preparationsStore, | ||
} | ||
}) | ||
|
||
export default store; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const preparationsStore = { | ||
namespaced: true, | ||
state: { | ||
preparationsIdToRepeat: [] | ||
}, | ||
mutations: { | ||
pushPreparation(state, preparationId) { | ||
state.preparationsIdToRepeat.push(preparationId) | ||
}, | ||
removePreparaion(state, preparationId) { | ||
const index = state.preparationsIdToRepeat.findIndex(el => { | ||
return el === preparationId | ||
}) | ||
|
||
state.preparationsIdToRepeat.splice(index, 1) | ||
} | ||
}, | ||
actions: { | ||
pushPreparation({state, commit}, preparationId) { | ||
state.preparationsIdToRepeat.find(id => { | ||
return id == preparationId | ||
}) | ||
? null | ||
: commit('pushPreparation', preparationId) | ||
}, | ||
removePreparaion({state, commit}, preparationId) { | ||
commit('removePreparaion', preparationId) | ||
} | ||
}, | ||
getters: { | ||
preparationsIdToRepeat(state) { | ||
return state.preparationsIdToRepeat | ||
} | ||
} | ||
}; | ||
|
||
export default preparationsStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.