Add deletion capability to sharecontroller

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-03-05 17:48:04 +08:00
parent e52d6dfb23
commit 8b285a7ea9

View file

@ -54,4 +54,18 @@ class ShareController: ObservableObject {
}
}
}
func delete() async -> NKError? {
Logger.shareController.info("Deleting share: \(self.share.url)")
return await withCheckedContinuation { continuation in
kit.deleteShare(idShare: share.idShare) { account, error in
Logger.shareController.info("Received delete response: \(self.share.url)")
defer { continuation.resume(returning: error) }
guard error == .success else {
Logger.shareController.error("Error deleting save: \(error.errorDescription)")
return
}
}
}
}
}