comparison client/src/store/imports.js @ 1344:eda98694e678

staging: retrieve real data instead of displaying demodata
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 26 Nov 2018 11:30:02 +0100
parents d5eda9f79610
children 58d41573e530
comparison
equal deleted inserted replaced
1343:9e0beb373690 1344:eda98694e678
29 imports: [], 29 imports: [],
30 staging: [] 30 staging: []
31 }; 31 };
32 }; 32 };
33 33
34 export default { 34 const imports = {
35 init, 35 init,
36 namespaced: true, 36 namespaced: true,
37 state: init(), 37 state: init(),
38 mutations: { 38 mutations: {
39 setImports: (state, imports) => { 39 setImports: (state, imports) => {
42 setStaging: (state, staging) => { 42 setStaging: (state, staging) => {
43 state.staging = staging; 43 state.staging = staging;
44 }, 44 },
45 45
46 toggleApproval: (state, change) => { 46 toggleApproval: (state, change) => {
47 throw "Not implemented!"; 47 const { id, newStatus } = change;
48 const { id, newState } = change;
49 const stagedResult = this.state.staging.find(e => { 48 const stagedResult = this.state.staging.find(e => {
50 return e.id === id; 49 return e.id === id;
51 }); 50 });
52 if (stagedResult.status === newState) { 51 if (stagedResult.status === newStatus) {
53 stagedResult.status = this.$options.STATES.NEEDSAPPROVAL; 52 stagedResult.status = STATES.NEEDSAPPROVAL;
54 } else { 53 } else {
55 stagedResult.status = newState; 54 stagedResult.status = newStatus;
56 } 55 }
57 } 56 }
58 }, 57 },
59 actions: { 58 actions: {
60 getImports({ commit }) { 59 getImports({ commit }) {
100 }); 99 });
101 }); 100 });
102 } 101 }
103 } 102 }
104 }; 103 };
104
105 export { imports, STATES };