This commit is contained in:
Andreani Jean
2023-06-28 11:03:18 +02:00
parent 671664d84f
commit e82e8b6841

View File

@@ -328,14 +328,13 @@ function spliceIntoChunks(arr: string[], chunkSize: number) {
return res
}
function patchAndResetCollection(isVisible: string, id: string): any {
function patchCollection(isVisible: string, id: string): any {
const itemPatched = axios.patch(
`api/collections/${route.params.id}/items/${id}`,
{
visible: isVisible
}
)
imagesToDelete.value = []
return itemPatched
}
async function patchCollectionItems(): Promise<void> {
@@ -350,7 +349,7 @@ async function patchCollectionItems(): Promise<void> {
if (imagesToDeleteHaveDifferentStatus.value) {
itemsPatch = await Promise.all(
el.map((ele) => {
return patchAndResetCollection('true', ele)
return patchCollection('true', ele)
})
)
} else {
@@ -363,7 +362,7 @@ async function patchCollectionItems(): Promise<void> {
imageToDelete?.properties['geovisio:status'] === 'ready'
? 'false'
: 'true'
return patchAndResetCollection(isVisible, ele)
return patchCollection(isVisible, ele)
})
)
}
@@ -378,6 +377,7 @@ async function patchCollectionItems(): Promise<void> {
toastLook.value = 'success'
patchOrDeleteIsLoading.value = false
scrollIntoSelected(imagesToDelete.value[0])
imagesToDelete.value = []
} catch (e) {
toastText.value = t('general.error_text')
toastLook.value = 'error'