import { Component } from '@angular/core';
import { User } from './user';
import { UserService } from './user.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';

  constructor(private servis: UserService){}

  allUsers: User[] = []

  getAllUsers(){
    this.servis.getAllUsers().subscribe(
      data=>{
        this.allUsers = data;
      }
    )

  }

  username: string = "";
  password: string = "";

  login(){
    this.servis.login(this.username, this.password).subscribe(
      data=>{
        if(data==null){
          alert("No login")
        }
        else{
          alert("Jeeee")
        }
      }
    )
  }
}
