Merge development (#86)
This commit is contained in:
@@ -27,20 +27,21 @@ const Component = () => {
|
||||
const [markers, setMarkers] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
retrieveAndStoreLocations().then((points) => {
|
||||
if (!token) return;
|
||||
retrieveAndStoreLocations(token).then((points) => {
|
||||
centerAroundMarkers(points);
|
||||
});
|
||||
const id = setInterval(function () {
|
||||
retrieveAndStoreLocations();
|
||||
retrieveAndStoreLocations(token);
|
||||
}, REQUEST_INTERVAL);
|
||||
return () => {
|
||||
clearInterval(id);
|
||||
};
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
}, [token]);
|
||||
|
||||
const retrieveAndStoreLocations = () => {
|
||||
return getLocations(token)
|
||||
const retrieveAndStoreLocations = (accessToken) => {
|
||||
return getLocations(accessToken)
|
||||
.then((result) => {
|
||||
if (result.data != null) {
|
||||
const points = result.data.map((point) => [
|
||||
@@ -73,6 +74,7 @@ const Component = () => {
|
||||
const [connections, setConnections] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
if (!token) return;
|
||||
if (markers.length > 0) {
|
||||
const vins = markers.map((marker) => marker[2]);
|
||||
getConnections(vins, token).then((connections) => {
|
||||
@@ -177,6 +179,7 @@ const Component = () => {
|
||||
doors={carState.doors}
|
||||
location={carState.location}
|
||||
windows={carState.windows}
|
||||
updatedAt={carState.updated}
|
||||
className={classes.popup}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user