57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
|
import { Injectable } from "@angular/core";
|
|
import { environment } from "../environments/environment";
|
|
import { Observable } from "rxjs";
|
|
import { AnswerStandard } from "./answerstandard.service";
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
|
|
export class EndPoint {
|
|
|
|
httpOptions: {};
|
|
|
|
constructor(
|
|
private http: HttpClient
|
|
) {
|
|
this.httpOptions = {
|
|
headers: new HttpHeaders({
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Authorization': 'Basic aWRlaWE6MTIzNDU2Nzg5OTk5OTk=='
|
|
})
|
|
}
|
|
}
|
|
|
|
public config(model: string): Observable<AnswerStandard> {
|
|
console.log('${environment.apiUrlAppCliente}config/custompage?model=${model}');
|
|
return this.http.get<AnswerStandard>('https://cliente.americanpet.com.br/api/v1/appclient/config/custompage?model=signin', this.httpOptions);
|
|
}
|
|
|
|
public consultCustomer(customer: any): Observable<AnswerStandard> {
|
|
// console.log('teste', customer),${environment.apiUrlAppCliente}customer/exists;
|
|
console.log('Requisição enviada:', {
|
|
body: customer,
|
|
});
|
|
|
|
return this.http.post<AnswerStandard>('https://cliente.americanpet.com.br/api/v1/appclient/customer/exists', customer, this.httpOptions);
|
|
}
|
|
|
|
public consultCep(cep: any): Observable<AnswerStandard> {
|
|
console.log('Requisição enviada:', {
|
|
body: cep,
|
|
});
|
|
return this.http.get<AnswerStandard>('https://cliente.americanpet.com.br/api/v1/appclient/consult/address?cep='+cep, this.httpOptions);
|
|
}
|
|
|
|
public registerCustomer(resgister: object): Observable<AnswerStandard> {
|
|
console.log('Requisição enviada:', {
|
|
body: resgister,
|
|
});
|
|
return this.http.post<AnswerStandard>('https://cliente.americanpet.com.br/api/v1/appclient/customer/new', resgister, this.httpOptions);
|
|
}
|
|
|
|
}
|
|
// appclient/customer/new
|
|
// https://cliente.americanpet.com.br/api/v1/appclient/config/custompage?model=signin
|
|
// ${environment.apiUrlAppCliente}config/custompage?model=${model}
|