rm logout action in gigawear

This commit is contained in:
2026-09-15 13:45:16 +03:00
parent 43528748d6
commit 4fa297ac6c
2 changed files with 6 additions and 11 deletions
@@ -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
} }
} }