Fix error message in geolocation
This commit is contained in:
parent
5d216d81d4
commit
c2270a860e
3 changed files with 17 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { Tracker } from 'meteor/tracker';
|
|||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { translate } from 'react-i18next';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
|
||||
import './CenterInMyPosition.scss';
|
||||
|
||||
|
|
@ -32,6 +33,16 @@ class CenterInMyPosition extends React.Component {
|
|||
// self.onViewportChanged(viewport);
|
||||
computation.stop();
|
||||
}
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/PositionError)
|
||||
const error = Geolocation.error();
|
||||
if (error) {
|
||||
const cod = error.code;
|
||||
// window.alert(cod);
|
||||
if (cod === 1) Bert.alert(self.props.t('geo-not-perms-error'), 'danger');
|
||||
else if (cod === 2) Bert.alert(self.props.t('geo-not-avail-error'), 'danger');
|
||||
else Bert.alert(error.message, 'danger');
|
||||
computation.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue