Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
fix coroutine flow
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverAndro committed Jun 18, 2022
1 parent d64c563 commit 4ce3d3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/com/github/p03w/modifold/core/ModrinthLogin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ suspend fun doWebFlow(): String {
Desktop.getDesktop().browse(URI.create(deviceCode.verification_uri))
}

return withContext(Dispatchers.IO) {
log("Waiting for approval...")
lateinit var authToken: String
log("Waiting for approval...")
lateinit var authToken: String
withContext(Dispatchers.IO) {
launch {
while (isActive) {
delay(deviceCode.interval.seconds + 100.milliseconds)
Expand All @@ -89,9 +89,9 @@ suspend fun doWebFlow(): String {
}
}
}
client.close()
return@withContext authToken
}
client.close()
return authToken
}

fun doManualEntry(): String {
Expand Down

0 comments on commit 4ce3d3c

Please sign in to comment.