import getUri from '../lib/ids'; import { putNewGpx } from './gpx'; import { put } from './lib'; export const emptyRte: Rte = { name: undefined, cmt: undefined, desc: undefined, src: undefined, link: undefined, number: 0, type: undefined, extensions: undefined, rtept: undefined, }; export const putNewRte = async (id?: IdRte | IdGpx) => { let finalId = { ...id }; if (!('rte' in finalId)) { const gpxId = await putNewGpx(id); finalId = { ...gpxId, rte: '00000' }; } const uri = getUri('rte', finalId); await put( uri, 'rte', (rte) => { return rte; }, emptyRte ); return finalId as IdRte; };