Properly sort cards in the frontend

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-01-31 16:18:35 +01:00
parent 8e83f126a6
commit 7e7e1e4c97
2 changed files with 31 additions and 15 deletions

View File

@@ -124,7 +124,7 @@ export default {
},
methods: {
onDropCard(stackId, event) {
async onDropCard(stackId, event) {
const { addedIndex, removedIndex, payload } = event
const card = Object.assign({}, payload)
if (this.stack.id === stackId) {
@@ -133,12 +133,12 @@ export default {
card.stackId = stackId
card.order = addedIndex
console.debug('move card to stack', card.stackId, card.order)
this.$store.dispatch('reorderCard', card)
await this.$store.dispatch('reorderCard', card)
}
if (addedIndex !== null && removedIndex !== null) {
card.order = addedIndex
console.debug('move card in stack', card.stackId, card.order)
this.$store.dispatch('reorderCard', card)
await this.$store.dispatch('reorderCard', card)
}
}
},