rm logout action in gigawear
This commit is contained in:
-10
@@ -1,10 +0,0 @@
|
|||||||
package ru.shadowsparky.gigawear.data
|
|
||||||
|
|
||||||
import org.koin.core.annotation.Factory
|
|
||||||
import ru.shadowsparky.http.domain.LogoutAction
|
|
||||||
import ru.shadowsparky.http.domain.TokenStorage
|
|
||||||
|
|
||||||
@Factory
|
|
||||||
class LogoutActionImpl(private val tokenStorage: TokenStorage) : LogoutAction {
|
|
||||||
override suspend fun logout() { tokenStorage.clear() }
|
|
||||||
}
|
|
||||||
@@ -66,7 +66,12 @@ class HttpModule {
|
|||||||
newToken.toKtor()
|
newToken.toKtor()
|
||||||
} catch (e: HttpException) {
|
} catch (e: HttpException) {
|
||||||
if (e.isServerFailure()) throw e
|
if (e.isServerFailure()) throw e
|
||||||
koin.getOrNull<LogoutAction>()?.logout()
|
val action = koin.getOrNull<LogoutAction>()
|
||||||
|
if (action == null) {
|
||||||
|
tokenStorage.clear()
|
||||||
|
} else {
|
||||||
|
action.logout()
|
||||||
|
}
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user