.
This commit is contained in:
parent
90727a314b
commit
8097e200c7
@ -4,6 +4,7 @@ import android.util.Log
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.header
|
||||
import io.ktor.client.request.patch
|
||||
import io.ktor.client.request.post
|
||||
import io.ktor.client.request.setBody
|
||||
import io.ktor.http.ContentType
|
||||
@ -24,6 +25,7 @@ object AuthNetworkDataSource {
|
||||
runCatching {
|
||||
val result = client.get("$SERVER_ADDRESS/api/login") {
|
||||
header(HttpHeaders.Authorization, token)
|
||||
|
||||
}
|
||||
Log.d("result", "${result.status}")
|
||||
if (result.status == HttpStatusCode.Unauthorized) {
|
||||
@ -31,7 +33,5 @@ object AuthNetworkDataSource {
|
||||
}
|
||||
result.body<UserDto>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ class GetUserUseCase(
|
||||
private val repo: UserRepo,
|
||||
private val authStorageDataSource: AuthStorageDataSource
|
||||
) {
|
||||
suspend fun getUserFromStorage() : UserDto? {
|
||||
private fun getUserFromStorage() : UserDto? {
|
||||
return authStorageDataSource.userInfo
|
||||
}
|
||||
suspend operator fun invoke() = repo.getUser(getUserFromStorage()?.login!!)
|
||||
|
@ -66,7 +66,6 @@ class QrScanFragment : Fragment(R.layout.fragment_qr_scan) {
|
||||
}
|
||||
is QrScanViewModel.Action.CloseWithResult -> {
|
||||
sendResult(QrScanDestination.packToBundle(action.result))
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import ru.myitschool.work.domain.user.EnterUseCase
|
||||
import ru.myitschool.work.utils.MutablePublishFlow
|
||||
|
||||
// НЕ ИЗМЕНЯЙТЕ ЭТОТ ФАЙЛ. В ТЕСТАХ ОН БУДЕМ ВОЗВРАЩЁН В ИСХОДНОЕ СОСТОЯНИЕ
|
||||
@ -90,4 +91,5 @@ class QrScanViewModel(
|
||||
|
||||
const val CAMERA_PERMISSION = Manifest.permission.CAMERA
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user