Skip to content

Commit

Permalink
feat: Update logout function
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Goel <[email protected]>
  • Loading branch information
Gaurav Goel committed Nov 8, 2024
1 parent 652d1f6 commit 2bd91fb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,17 @@ class SingleFactorAuth(
}
}

fun logout(context: Context) {
sessionManager.invalidateSession(context).whenComplete { res, _ ->
fun logout(context: Context): CompletableFuture<Void> {
val logoutCF = CompletableFuture<Void>()
sessionManager.invalidateSession(context).whenComplete { res, err ->
if (res) {
SessionManager.deleteSessionIdFromStorage()
this.state = null
logoutCF.complete(null)
} else {
logoutCF.completeExceptionally(err)
}
}
return logoutCF
}
}

0 comments on commit 2bd91fb

Please sign in to comment.