import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Korisnik } from '../modeli/korisnik';

@Injectable({
  providedIn: 'root'
})
export class KorisniciService {

  constructor() { }

  url = 'http://localhost:8080/korisnici';

  http = inject(HttpClient)

  prijava(username: string, password: string, tip: string) {
    const data = {
      korisnicko_ime: username,
      lozinka: password,
      tip: tip,
    };
    return this.http.post<Korisnik>(`${this.url}/prijava`, data);
  }
}
