From 1c052c4f4c55283fce4aeb32a3880a6badce2f6d Mon Sep 17 00:00:00 2001 From: Vitor Gomes Date: Thu, 10 Oct 2024 10:42:33 -0300 Subject: [PATCH] Avoid using async/await with then callbacks --- src/utils/MineWinsConflictsResolver.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/utils/MineWinsConflictsResolver.ts b/src/utils/MineWinsConflictsResolver.ts index d2e08a81..882caec6 100644 --- a/src/utils/MineWinsConflictsResolver.ts +++ b/src/utils/MineWinsConflictsResolver.ts @@ -49,18 +49,17 @@ export class MineWinsConflictsResolver implements ConflictsResolver { } public async resolveAll() { - return await this.client.getConflicts>(this.bucket).then((data) => { - const { data: conflicts }: { data: VBaseConflictData[] } = data - - const resolved = conflicts.map((conflict) => { - conflict.base.parsedContent = this.parseConflict(conflict.base) - conflict.master.parsedContent = this.parseConflict(conflict.master) - conflict.mine.parsedContent = this.parseConflict(conflict.mine) - return this.resolveConflictMineWins(conflict) - }) - - return resolved as any + const conflictsResponse = await this.client.getConflicts>(this.bucket) + const { data: conflicts }: { data: VBaseConflictData[] } = conflictsResponse + + const resolvedConflicts = conflicts.map((conflict) => { + conflict.base.parsedContent = this.parseConflict(conflict.base) + conflict.master.parsedContent = this.parseConflict(conflict.master) + conflict.mine.parsedContent = this.parseConflict(conflict.mine) + return this.resolveConflictMineWins(conflict) }) + + return resolvedConflicts } protected mergeMineWins(base: Configuration, master: Configuration, mine: Configuration) {