import getUri from '../lib/ids'; import { put } from './lib'; import { putNewRte } from './rte'; export const emptyRtept: Wpt = { $: { lat: 0, lon: 0 }, ele: undefined, time: undefined, magvar: undefined, geoidheight: undefined, name: undefined, cmt: undefined, desc: undefined, src: undefined, link: undefined, sym: undefined, type: undefined, fix: undefined, sat: undefined, hdop: undefined, vdop: undefined, pdop: undefined, ageofdgpsdata: undefined, dgpsid: undefined, extensions: undefined, }; export const putNewRtept = async (id?: IdGpx | IdRte | IdRtept) => { let finalId = { ...id }; if (!('rtept' in finalId)) { const rteId = await putNewRte(id); finalId = { ...rteId, rtept: '00000' }; } const uri = getUri('rtept', finalId); await put( uri, 'rtept', (rtept) => { return rtept; }, emptyRtept ); return finalId as IdRtept; };