package com.example.matuletest.domain import androidx.compose.ui.graphics.drawscope.Stroke import com.example.matuletest.data.remotesource.SupaBaseClient import io.github.jan.supabase.auth.SessionManager import io.github.jan.supabase.auth.auth import io.github.jan.supabase.auth.providers.builtin.Email import io.github.jan.supabase.auth.status.SessionStatus import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.flow class AuthUseCase { suspend fun auth(email: String, password: String)= flow{ SupaBaseClient.instance.auth.signInWith(Email){ this.email = email this.password = password } SupaBaseClient.instance.auth.sessionStatus.collect{ status -> when(status){ is SessionStatus.Authenticated -> emit(true) is SessionStatus.Initializing -> {} else -> emit(false) } } } }