Merge development (#86)

This commit is contained in:
John Wu
2021-09-13 09:15:20 -07:00
committed by GitHub
parent 74eb2707a3
commit 680280dbf2
32 changed files with 465 additions and 466 deletions

View File

@@ -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}
/>