Skip to content

Commit

Permalink
If login fails, don't leave the current lemmy instance on the invalid…
Browse files Browse the repository at this point in the history
… instance. (#521)
  • Loading branch information
camporter authored Jun 12, 2023
1 parent d4f7188 commit cc75c10
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LoginViewModel : ViewModel() {
homeViewModel: HomeViewModel,
ctx: Context,
) {
val originalInstance = API.currentInstance
val api = API.changeLemmyInstance(instance)

viewModelScope.launch {
Expand All @@ -60,6 +61,7 @@ class LoginViewModel : ViewModel() {
msg,
Toast.LENGTH_SHORT,
).show()
API.changeLemmyInstance(originalInstance)
this.cancel()
return@launch
}
Expand All @@ -72,6 +74,7 @@ class LoginViewModel : ViewModel() {
msg,
Toast.LENGTH_SHORT,
).show()
API.changeLemmyInstance(originalInstance)
this.cancel()
return@launch
}
Expand Down

0 comments on commit cc75c10

Please sign in to comment.