-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlacePageModel.js
35 lines (29 loc) · 974 Bytes
/
PlacePageModel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { decorate, observable } from "mobx";
import Utils from './Utils';
export default class PlacePageModel {
static instance = null;
static getInstance() {
if (this.instance === null) {
this.instance = new PlacePageModel();
}
return this.instance;
}
place;
setPlace(place) {
console.log('place was set: ' + JSON.stringify(place));
if (place !== this.place) {
// create url
if (place.details.photos) {
place.details.photos.forEach(photo => {
photo.url = `https://maps.googleapis.com/maps/api/place/photo?maxwidth=${photo.width}&photoreference=${photo.photo_reference}&key=${Utils.getInstance().key}`;
});
}
this.place = place;
}
}
// openingHours should be local mobx state handling
// showClockIcon = false;
}
decorate(PlacePageModel, {
// place: observable
});