x1tosi il y a 1 mois
Parent
commit
fb10fec866

+ 0 - 25
app/src/main/java/com/example/fitmarcetplacekuzminiv/MainViewModel.kt

@@ -4,21 +4,12 @@ import androidx.compose.runtime.mutableStateOf
 import androidx.lifecycle.ViewModel
 import androidx.lifecycle.viewModelScope
 import com.example.fitmarcetplacekuzminiv.domain.Constants
-import com.example.fitmarcetplacekuzminiv.domain.Constants.supabase
-import com.google.android.gms.analytics.ecommerce.Product
 import io.github.jan.supabase.gotrue.auth
 import io.github.jan.supabase.gotrue.providers.builtin.Email
-import io.github.jan.supabase.postgrest.from
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
 import kotlinx.coroutines.launch
 
-data class Product(val id: Int, val name: String, val price: Double)
-
 class MainViewModel : ViewModel() {
 
-    private val _products = MutableStateFlow<List<Product>>(emptyList())
-    val products: StateFlow<List<Product>> = _products
     // Состояние для хранения результата авторизации
     var authResult = mutableStateOf("")
 
@@ -38,20 +29,4 @@ class MainViewModel : ViewModel() {
             }
         }
     }
-    //Обновление для извлечения данных
-    fun fetchProducts() {
-        viewModelScope.launch {
-            try {
-                // Fetch data from Supabase or other data source
-                val productList = supabase.from("products").select().decodeList<Product>()
-                _products.value = productList
-            } catch (e: Exception) {
-                // Handle the error
-                println("Error fetching products: ${e.message}")
-            }
-        }
-    }
 }
-
-
-

+ 2 - 1
app/src/main/java/com/example/fitmarcetplacekuzminiv/Screens/authScreen.kt

@@ -6,10 +6,11 @@ import androidx.compose.runtime.*
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.TextFieldValue
 import androidx.compose.ui.unit.dp
 import androidx.navigation.NavController
 import com.example.fitmarcetplacekuzminiv.MainViewModel
-//страница авторизацииd
+
 @Composable
 fun AuthScreen(navController: NavController, mainViewModel: MainViewModel) {
     val email = remember { mutableStateOf("") }