Advertisement
bebo231312312321

Untitled

Mar 28th, 2024
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient } from '@angular/common/http';
  3. import { UserForAuth } from '../types/user';
  4.  
  5. @Injectable({
  6.   providedIn: 'root'
  7. })
  8. export class UserService {
  9.  
  10.   // Адресът на API
  11.   private apiUrl = 'http://localhost:3000';
  12.  
  13.   constructor(private http: HttpClient) { }
  14.  
  15.   register(
  16.     username: string,
  17.     email: string,
  18.     password: string,
  19.     rePassword: string
  20.   ) {
  21.  
  22.     return this.http.post<UserForAuth>(`${this.apiUrl}/users/register`, {
  23.       username,
  24.       email,
  25.       password,
  26.     });
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement