UNPKG

test-http-service

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.0.

32 lines (24 loc) 690 B
import { HttpClient } from "@angular/common/http"; import { Injectable } from '@angular/core'; import { Observable } from "rxjs"; export interface accessToken { name: string, timestamp: Date } @Injectable({ providedIn: 'root' }) export class HttpServiceTest { constructor(private http: HttpClient) { console.log('creating instance of http service') } getToken(name: string) { return this.http.get(`http://localhost:5000/session/${name}`); } setToken(loginToken: accessToken) { return this.http.post('http://localhost:5000/session',loginToken); } destroyToken(name: string) { return this.http.delete(`http://localhost:5000/session/${name}`); } }