1
0

fix: kanban drag task test

This commit is contained in:
Dominik Pschenitschni
2021-10-02 20:10:49 +02:00
parent d66ad12f5c
commit 4ae18ec162
3 changed files with 10 additions and 53 deletions

View File

@ -378,43 +378,6 @@ export default {
.finally(() => cancel())
},
updateBuckets(ctx, updatedBucketsData) {
const cancel = setLoading(ctx, 'kanban')
const oldBuckets = []
const updatedBuckets = updatedBucketsData.map((updatedBucketData) => {
const bucketIndex = findIndexById(ctx.state.buckets, updatedBucketData.id)
const bucket = ctx.state.buckets[bucketIndex]
const oldBucket = cloneDeep(bucket)
oldBuckets.push(oldBucket)
const newBucket = {
// FIXME: maybe optional to set the original value as well
...bucket,
id: updatedBucketData.id,
listId: updatedBucketData.listId || oldBucket.listId,
...updatedBucketData,
}
ctx.commit('setBucketByIndex', {bucketIndex, bucket: newBucket})
const bucketService = new BucketService()
return bucketService.update(newBucket)
})
return Promise.all(updatedBuckets)
.then(r => {
Promise.resolve(r)
})
.catch(e => {
// restore original state
Object.values(updatedBuckets).forEach((oldBucket) => ctx.commit('setBucketById', oldBucket))
return Promise.reject(e)
})
.finally(() => cancel())
},
updateBucketTitle(ctx, { id, title }) {
const bucket = findById(ctx.state.buckets, id)