mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 01:35:09 +01:00
add 400 response login refresh for mal (#476)
* add 400 response update to mal * clean up imports
This commit is contained in:
parent
4a30968236
commit
8ce1d94fd2
@ -104,7 +104,7 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun refreshLogin() {
|
||||
suspend fun refreshLogin() {
|
||||
val username = getUsername()
|
||||
val password = getPassword()
|
||||
logout()
|
||||
|
@ -21,7 +21,17 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList) : Interceptor
|
||||
myanimelist.ensureLoggedIn()
|
||||
}
|
||||
val request = chain.request()
|
||||
return chain.proceed(updateRequest(request))
|
||||
var response = chain.proceed(updateRequest(request))
|
||||
|
||||
if (response.code == 400) {
|
||||
scope.launch {
|
||||
myanimelist.refreshLogin()
|
||||
}
|
||||
response.close()
|
||||
response = chain.proceed(updateRequest(request))
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
private fun updateRequest(request: Request): Request {
|
||||
|
Loading…
Reference in New Issue
Block a user