|
|
|
@@ -26,13 +26,11 @@ export class MallsPage implements OnInit { |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
this.getMallsByLocation(); |
|
|
|
this.getMallsByFoodType('pizza'); |
|
|
|
} |
|
|
|
|
|
|
|
toggleMallBookmark(index: number) { |
|
|
|
this.tempMalls[index].mall.is_bookmarked = !this.tempMalls[index].mall.is_bookmarked; |
|
|
|
this.allMalls[index].mall.is_bookmarked = !this.allMalls[index].mall.is_bookmarked; |
|
|
|
localStorage.allMalls = JSON.stringify(this.allMalls); |
|
|
|
console.log(this.tempMalls[index].mall); |
|
|
|
this.mallService.updateMallData(this.tempMalls[index]); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -86,10 +84,9 @@ export class MallsPage implements OnInit { |
|
|
|
this.toastService.presentToast("Getting malls based on your location...", "dark"); |
|
|
|
navigator.geolocation.getCurrentPosition((position) => { |
|
|
|
this.mallService.mallsByLocation(position.coords.latitude, position.coords.longitude).then((response: any) => { |
|
|
|
if (response.length > 0) { |
|
|
|
localStorage.allMalls = JSON.stringify(response); |
|
|
|
this.allMalls = JSON.parse(localStorage.allMalls); |
|
|
|
this.tempMalls = JSON.parse(localStorage.allMalls); |
|
|
|
if (response.length > 0) { |
|
|
|
this.allMalls = response; |
|
|
|
this.tempMalls = response; |
|
|
|
} else { |
|
|
|
this.toastService.presentToast("No malls near you your location, Getting all the malls...", "warning"); |
|
|
|
this.getAllMalls(); |
|
|
|
@@ -105,9 +102,8 @@ export class MallsPage implements OnInit { |
|
|
|
|
|
|
|
getAllMalls() { |
|
|
|
this.mallService.allMalls().then((response) => { |
|
|
|
localStorage.allMalls = JSON.stringify(response); |
|
|
|
this.allMalls = JSON.parse(localStorage.allMalls); |
|
|
|
this.tempMalls = JSON.parse(localStorage.allMalls); |
|
|
|
this.allMalls = response; |
|
|
|
this.tempMalls = response; |
|
|
|
}, (error) => { |
|
|
|
console.log(error); |
|
|
|
}); |
|
|
|
|