mirror of
https://github.com/Nezumi-2711/foodify-frontend.git
synced 2026-09-22 20:01:17 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { User } from '../tables/user';
|
||||
import { StringBoolObject } from '../tables/string-bool-object';
|
||||
import { Address } from '../tables/address';
|
||||
import { Shop } from '../tables/shop';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthService {
|
||||
private baseUrl = `${environment.foodOrderingBaseApiUrl}/auth`;
|
||||
|
||||
constructor(private httpClient: HttpClient) {
|
||||
|
||||
}
|
||||
|
||||
//Sign-up new User
|
||||
SignUpUser(user: User): Observable<User> {
|
||||
return this.httpClient.post<User>(this.baseUrl + '/register', user);
|
||||
}
|
||||
|
||||
//Sign-up address for user
|
||||
SignUpUserAddress(userId: number, address: Address) {
|
||||
return this.httpClient.post<StringBoolObject>(this.baseUrl + `/${userId}/addresses`, address)
|
||||
}
|
||||
|
||||
//Sign-up new shop
|
||||
SignUpShop(shop: Shop) {
|
||||
return this.httpClient.post(this.baseUrl + "/register-shop", shop)
|
||||
}
|
||||
|
||||
checkEmailOrPhoneNumberExist(userDto: User) {
|
||||
return this.httpClient.post<StringBoolObject>(this.baseUrl + `/check`, userDto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user