From df555cb339cb92aa3a99a7cf9296435dd1f53402 Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Mon, 12 Sep 2022 21:17:31 -0300 Subject: [PATCH] API GET WORKING! --- frontend/main/src/app/login/login.component.ts | 2 +- frontend/main/src/app/quote.service.ts | 4 ++-- frontend/main/src/app/ship-qt/ship-qt.component.ts | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/main/src/app/login/login.component.ts b/frontend/main/src/app/login/login.component.ts index fe1aeb9..b55c52f 100644 --- a/frontend/main/src/app/login/login.component.ts +++ b/frontend/main/src/app/login/login.component.ts @@ -29,7 +29,7 @@ export class LoginComponent implements OnInit { this.loginService.logging(this.user, this.password) .pipe( catchError((error)=>{ - return of(['Deu erro parcero é isso', 'tu não vai encontrar detalhe aqui','pode sair já...', error, 'só pq sou teu amigo vou deixar esse error ai']) + return of([error]) }) ) .subscribe((response)=>{ diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index 1e24ae2..12e05db 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -8,13 +8,13 @@ import { ShipQtComponent } from './ship-qt/ship-qt.component'; }) export class QuoteService { - apiURL:string = 'https://maps.googleapis.com/maps/api/distancematrix/json?destinations=' + apiURL:string = 'https://maps.googleapis.com/maps/api/directions/json?origin=' constructor(private http: HttpClient) { } quote(cepOrigem:string, cepDestino:string):any{ - return this.http.get(this.apiURL+cepOrigem+'&origins='+cepDestino+'&units=imperial&key=AIzaSyCKNjLUI0d01M0SfoDjIov4vZlR3DprotM') + return this.http.get(this.apiURL+cepOrigem+'&destination='+cepDestino+'&key=AIzaSyCKNjLUI0d01M0SfoDjIov4vZlR3DprotM') } diff --git a/frontend/main/src/app/ship-qt/ship-qt.component.ts b/frontend/main/src/app/ship-qt/ship-qt.component.ts index 46a012b..b8af75f 100644 --- a/frontend/main/src/app/ship-qt/ship-qt.component.ts +++ b/frontend/main/src/app/ship-qt/ship-qt.component.ts @@ -36,9 +36,7 @@ export class ShipQtComponent implements OnInit { .pipe() .subscribe((response:any) => { console.log(response); - console.log(response.rows); - console.log(response.rows); - alert(`${response.rows.elements.duration.text}`) + console.log(response.routes[0].legs[0].duration.text); }) }else{ alert('DIGITE TODOS OS DADOS!')