Browse Source

Get malls by food type API connection

master
kj1352 5 years ago
parent
commit
fa7a5b0e9a
2 changed files with 20 additions and 0 deletions
  1. +7
    -0
      src/app/malls/malls.page.ts
  2. +13
    -0
      src/app/services/mall.service.ts

+ 7
- 0
src/app/malls/malls.page.ts View File

@@ -26,6 +26,7 @@ export class MallsPage implements OnInit {

ngOnInit() {
this.getMallsByLocation();
this.getMallsByFoodType('pizza');
}

toggleMallBookmark(index: number) {
@@ -74,6 +75,12 @@ export class MallsPage implements OnInit {
}
}

getMallsByFoodType(type: string) {
this.mallService.mallsByTypes(type).then((data) => {
console.log(data);
});
}

getMallsByLocation() {
if (navigator.geolocation) {
this.toastService.presentToast("Getting malls based on your location...", "dark");


+ 13
- 0
src/app/services/mall.service.ts View File

@@ -22,6 +22,19 @@ export class MallService {
};

return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/' + latitude + '/longitude/' + longitude + '/check/', httpOptions).toPromise();
}

async mallsByTypes(type: string) {
const httpOptions = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + localStorage.access_Token
})
};

return await this.http.get(URL + '/api/maioraservice/mall/v1/outlet_type/' + type + '/', httpOptions).toPromise();
}

async allMalls() {


Loading…
Cancel
Save