feat: colleciton delete
Some checks failed
Build Test / test (pull_request) Successful in 30s
JS Unit Tests / test (pull_request) Failing after 28s
PHP Unit Tests / test (pull_request) Successful in 1m7s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-05 22:32:52 -04:00
parent 5988a372bc
commit b682b0629c
6 changed files with 74 additions and 11 deletions

View File

@@ -385,12 +385,16 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
*
* @returns Promise with deletion result
*/
async function remove(provider: string, service: string | number, identifier: string | number): Promise<any> {
async function remove(provider: string, service: string | number, identifier: string | number): Promise<CollectionObject | boolean> {
transceiving.value = true
try {
await collectionService.delete({ provider, service, identifier })
const response = await collectionService.delete({ provider, service, identifier })
// Remove deleted collection from state
if (response !== true && !(response instanceof CollectionObject)) {
console.warn('[Mail Manager][Store] - Delete failed. Received unexpected response from delete operation:', response)
return false
}
const key = identifierKey(provider, service, identifier)
const previousCollection = _collections.value[key]
@@ -400,7 +404,19 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
delete _collections.value[key]
if (response instanceof CollectionObject) {
const movedCollection = response
const movedKey = identifierKey(movedCollection.provider, movedCollection.service, movedCollection.identifier)
_collections.value[movedKey] = movedCollection
indexCollection(movedCollection)
console.debug('[Mail Manager][Store] - Successfully moved collection to trash', key, '->', movedKey)
return response
}
console.debug('[Mail Manager][Store] - Successfully deleted collection:', key)
return response
} catch (error: any) {
console.error('[Mail Manager][Store] - Failed to delete collection:', error)
throw error