summaryrefslogtreecommitdiff
path: root/src/client/app/store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/store.ts')
-rw-r--r--src/client/app/store.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/app/store.ts b/src/client/app/store.ts
index 53f3eefc08..08dd9f9920 100644
--- a/src/client/app/store.ts
+++ b/src/client/app/store.ts
@@ -4,6 +4,7 @@ import * as nestedProperty from 'nested-property';
import MiOS from './mios';
import { hostname } from './config';
+import { erase } from '../../prelude/array';
const defaultSettings = {
home: null,
@@ -195,7 +196,7 @@ export default (os: MiOS) => new Vuex.Store({
removeDeckColumn(state, id) {
state.deck.columns = state.deck.columns.filter(c => c.id != id);
- state.deck.layout = state.deck.layout.map(ids => ids.filter(x => x != id));
+ state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
},
@@ -266,7 +267,7 @@ export default (os: MiOS) => new Vuex.Store({
stackLeftDeckColumn(state, id) {
const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1);
- state.deck.layout = state.deck.layout.map(ids => ids.filter(x => x != id));
+ state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
const left = state.deck.layout[i - 1];
if (left) state.deck.layout[i - 1].push(id);
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
@@ -274,7 +275,7 @@ export default (os: MiOS) => new Vuex.Store({
popRightDeckColumn(state, id) {
const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1);
- state.deck.layout = state.deck.layout.map(ids => ids.filter(x => x != id));
+ state.deck.layout = state.deck.layout.map(ids => erase(id, ids));
state.deck.layout.splice(i + 1, 0, [id]);
state.deck.layout = state.deck.layout.filter(ids => ids.length > 0);
},