Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from "@angular/core";
- import { HttpClient } from "@angular/common/http";
- import { User } from "../models/user";
- @Injectable({ providedIn: "root" })
- export class UserService {
- constructor(private http: HttpClient) {}
- getById(id: string) {
- return this.http.get<User>(`http://localhost:3000/users/${id}`)
- }
- checkIn(user: User) {
- return this.http.post('http://localhost:3000/checkIn', user);
- }
- checkOut(user: User) {
- return this.http.post('http://localhost:3000/checkOut', user);
- }
- getAll() {
- return this.http.get<User[]>(`http://localhost:4200/users`);
- }
- register(user: User) {
- return this.http.post(`http://localhost:4200/users/register`, user);
- }
- delete(id: number) {
- return this.http.delete(`http://localhost:4200/users/${id}`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement