|
@@ -7,6 +7,7 @@ import com.example.eatwell.Resources
|
|
|
import com.example.eatwell.domain.Constant
|
|
|
import com.example.eatwell.model.Category
|
|
|
import com.example.eatwell.model.Diets
|
|
|
+import com.example.eatwell.model.Dish
|
|
|
import com.example.eatwell.model.Fridge
|
|
|
import com.example.eatwell.model.Ingredients
|
|
|
import com.example.eatwell.model.Recipes
|
|
@@ -19,7 +20,6 @@ import java.util.UUID
|
|
|
|
|
|
class MainViewModel():ViewModel() {
|
|
|
|
|
|
-
|
|
|
fun onSignInEmailPassword(emailUser: String, passwordUser: String) {
|
|
|
viewModelScope.launch {
|
|
|
try {
|
|
@@ -97,6 +97,21 @@ class MainViewModel():ViewModel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ fun getDishes(){
|
|
|
+
|
|
|
+ viewModelScope.launch {
|
|
|
+ try {
|
|
|
+ Resources.dishes = Constant.supabase.from("Dish").select{
|
|
|
+ "*"
|
|
|
+ }.decodeList<Dish>() as ArrayList<Dish>
|
|
|
+
|
|
|
+ Log.d("Блюда: ", Resources.dishes.toString())
|
|
|
+ } catch (e: Exception) {
|
|
|
+ Log.e("Ошибка б: ", e.message.toString())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
fun deleteIngredient(ingredientId: Int) {
|
|
|
|
|
|
viewModelScope.launch {
|