//
//  ContentView.swift
//  Comedores Sociales
//
//  Created by Hector Carrion on 10/24/20.
//

import SwiftUI

struct ContentView: View {
    @StateObject var lvm = LoginViewModel()
    @StateObject var rvm = RegisterViewModel()
    @StateObject var pvm = ProfileViewModel()

    var body: some View {
        if lvm.response == .success || rvm.response == .success || UserDefaults.standard.bool(forKey: "logged-in") {
            SearchContainer()
                .environmentObject(pvm)
        } else {
            LoginView()
                .environmentObject(lvm)
                .environmentObject(rvm)
        }

    }
}
