package ru.myitschool.work.domain.auth

import ru.myitschool.work.data.repo.AuthRepository

class CheckAndSaveAuthDataUseCase(
    private val repository: AuthRepository
) {
    suspend operator fun invoke(
        textLogin: String,
        textPassword: String
    ): Result<Unit> {
        return repository.checkAndSave(textLogin, textPassword).mapCatching { success ->
            if (!success) {
                error("Login or password is incorrect")

            }
        }
    }
}