From 0aa50c6eeafb5df1a93b730133e9325621ded833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Sat, 2 Feb 2019 20:58:48 +0900 Subject: [PATCH] Update store.ts --- src/client/app/store.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/client/app/store.ts b/src/client/app/store.ts index 46655b7bd..065f0767d 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -309,15 +309,17 @@ 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 => 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); + const i = state.deck.layout.findIndex(ids => ~ids.indexOf(id)); + if (i) { + 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); + } }, popRightDeckColumn(state, id) { - const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1); + const i = state.deck.layout.findIndex(ids => ~ids.indexOf(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);