Removing localforage and friends.
This commit is contained in:
1 parent
2831f901a7
commit
52ca7e3fe7
6 files changed
+938
-155
No files matched your search
@@ -19,7 +19,6 @@ import {
|
||||
} from '@ionic/react';
|
||||
|
||||
import GpxImport from './gpx-import';
|
||||
import Track from './track';
|
||||
import Tracks from './tracks';
|
||||
|
||||
const Map: react.FC<{}> = (props: {}) => {
|
||||
|
||||
@@ -1,30 +1,9 @@
|
||||
import React, { useContext, useEffect } from 'react';
|
||||
import React, { } from 'react';
|
||||
|
||||
import { DbContext } from '../../db/db-context-provider';
|
||||
import { lat2tile, lon2tile } from '../../lib/geo';
|
||||
import { zoom0 } from '../../store/map';
|
||||
|
||||
const Track: React.FC<{ track: any; id: string }> = (props) => {
|
||||
const dbContext = useContext(DbContext);
|
||||
|
||||
useEffect(() => {
|
||||
const store = dbContext.tracksStore;
|
||||
const checkDb = async () => {
|
||||
store.getItem(props.id).then((value) => {
|
||||
if (value === null) {
|
||||
store.setItem(props.id, props.track).then((value) => {
|
||||
console.log(
|
||||
`Track ${props.id} saved in the ${store.driver()} Database.`
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
if (dbContext.ready) {
|
||||
checkDb();
|
||||
}
|
||||
}, [dbContext, props]);
|
||||
|
||||
const trkseg = props.track.track.trk[0].trkseg[0];
|
||||
const d = trkseg.trkpt.reduce(
|
||||
(previous: string, current: any, index: number) => {
|
||||
|
||||
Reference in new issue
Block a user