package com.zyzf.coffeepreorder.ui.register

import androidx.lifecycle.ViewModel
import com.zyzf.coffeepreorder.database.model.User
import com.zyzf.coffeepreorder.database.repository.UserRepository

class RegisterViewModel(
    private val userRepository: UserRepository
) : ViewModel() {
    suspend fun register(user: User): User? {
        userRepository.insert(user)
        return userRepository.tryLogin(user.login, user.password)
    }
}
