Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { AuthData } from './auth/auth-data.model';
- import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpClient } from '@angular/common/http';
- import { Observable } from 'rxjs';
- @Injectable({
- providedIn: 'root'
- })
- export class BackendService {
- private backendHost: String = 'http://localhost:5000';
- constructor(private http: HttpClient) {
- }
- /* Authentication */
- registerUser(authData: AuthData) {
- return this.http.post(this.backendHost + '/register', authData);
- }
- loginUser(authData: AuthData) {
- return this.http.post(this.backendHost + '/auth', authData);
- }
- /* Products */
- createProduct(products: any[]) {
- return this.http.post(this.backendHost + '/product', products[0]);
- }
- deleteProduct(product_id: Number) {
- return this.http.delete(this.backendHost + '/product/' + product_id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement