2020-05-08 18:02:18 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
namespaced: true,
|
|
|
|
strict: true,
|
|
|
|
state: {
|
|
|
|
connections: [],
|
2020-05-23 13:32:14 +02:00
|
|
|
is_new_modal: false,
|
|
|
|
is_edit_modal: false
|
2020-05-12 18:27:31 +02:00
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
getConnections: state => state.connections,
|
|
|
|
isNewModal: state => state.is_new_modal
|
2020-05-08 18:02:18 +02:00
|
|
|
},
|
|
|
|
mutations: {
|
2020-05-12 18:27:31 +02:00
|
|
|
ADD_CONNECTION (state, connection) {
|
|
|
|
state.connections.push(connection);
|
|
|
|
},
|
2020-05-23 13:32:14 +02:00
|
|
|
DELETE_CONNECTION (state, connection) {
|
|
|
|
state.connections = state.connections.filter(el => el.uid !== connection.uid);
|
|
|
|
},
|
2020-05-22 19:32:55 +02:00
|
|
|
UPDATE_CONNECTIONS (state, connections) {
|
|
|
|
state.connections = connections;
|
|
|
|
},
|
2020-05-12 18:27:31 +02:00
|
|
|
SHOW_NEW_CONNECTION_MODAL (state) {
|
|
|
|
state.is_new_modal = true;
|
2020-05-08 18:02:18 +02:00
|
|
|
},
|
2020-05-12 18:27:31 +02:00
|
|
|
HIDE_NEW_CONNECTION_MODAL (state) {
|
|
|
|
state.is_new_modal = false;
|
2020-05-08 18:02:18 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
actions: {
|
2020-05-12 18:27:31 +02:00
|
|
|
addConnection ({ commit }, connection) {
|
|
|
|
commit('ADD_CONNECTION', connection);
|
|
|
|
},
|
2020-05-23 13:32:14 +02:00
|
|
|
deleteConnection ({ commit }, connection) {
|
|
|
|
commit('DELETE_CONNECTION', connection);
|
|
|
|
},
|
|
|
|
editConnection ({ commit }, connection) {
|
|
|
|
commit('EDIT_CONNECTION', connection);
|
|
|
|
},
|
2020-05-22 19:32:55 +02:00
|
|
|
updateConnections ({ commit }, connections) {
|
|
|
|
commit('UPDATE_CONNECTIONS', connections);
|
|
|
|
},
|
2020-05-11 18:05:34 +02:00
|
|
|
// Modals
|
2020-05-08 18:02:18 +02:00
|
|
|
showNewConnModal ({ commit }) {
|
2020-05-12 18:27:31 +02:00
|
|
|
commit('SHOW_NEW_CONNECTION_MODAL');
|
2020-05-08 18:02:18 +02:00
|
|
|
},
|
|
|
|
hideNewConnModal ({ commit }) {
|
2020-05-12 18:27:31 +02:00
|
|
|
commit('HIDE_NEW_CONNECTION_MODAL');
|
2020-05-08 18:02:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|