import { Injectable } from '@angular/core'; import { of } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import { AppService } from '../app'; import { User, UserJson } from '../../models'; @Injectable({providedIn:'root'}) export class UsersService { ext = "/users"; constructor(private app:AppService){} fetch(){return this.app.http.get(this.ext);} fetchOne(username:string){return this.app.http.get(this.ext+"/"+username);} create(o:{username:string}){return this.app.http.post(this.ext,o);} update(id:string,updates:Partial){return this.app.http.put(this.ext+"/"+id,updates);} remove(id:string){return this.app.http.del(this.ext+"/"+id);} }