git init v2
This commit is contained in:
24
src/app/services/customer.service.ts
Normal file
24
src/app/services/customer.service.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Customer} from '../models/customer';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CustomerService {
|
||||
baseApi = "http://localhost:8080/api/customers";
|
||||
// baseApi = "https://api.melvanveen.nl/api/customers";
|
||||
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
getCustomers(): Observable<Customer[]> {
|
||||
return this.http.get<Customer[]>(`${this.baseApi}`);
|
||||
}
|
||||
|
||||
addCustomer(customer: Customer): Observable<Customer> {
|
||||
return this.http.post<Customer>(`${this.baseApi}`, customer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user