You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportinterfaceAddress{line1: string;line2: string;}functiongetCurrentPosition(): Promise<GeolocationPosition>{returnnewPromise((resolve,reject)=>{if(navigator.geolocation){navigator.geolocation.getCurrentPosition((position)=>{resolve(position);},(error)=>{reject(error);},{enableHighAccuracy: true,timeout: 5000,maximumAge: 0});}else{reject(newError('Geolocation is not supported by this browser.'));}});}asyncfunctionfetchLocation(lat: number,lon: number): Promise<Address>{// TODO change api key and set new one in .envconstAPI_KEY='be669b3d2f4d4c8ea1159c413ac1da78';try{constresponse=awaitfetch(`https://api.geoapify.com/v1/geocode/reverse?lat=${lat}&lon=${lon}&apiKey=${API_KEY}`);constdata=awaitresponse.json();const{ address_line1, address_line2 }=data.features[0].properties;return{line1: address_line1,line2: address_line2};}catch(error){thrownewError(String(error));}}exportasyncfunctiongetAddress(): Promise<Address>{const{coords: { latitude, longitude }}=awaitgetCurrentPosition();returnawaitfetchLocation(latitude,longitude);}
193b12882ac6504ea96127b2cc845c12edbbec7a
The text was updated successfully, but these errors were encountered:
change api key and set new one in .env
https://github.com/LukaHarambasic/harambasic.de/blob/912a632d2d6ced828b1e158d6a8394317298d6a3/src/routes/(playground)/cards/[slug]/getAddress.ts#L29
193b12882ac6504ea96127b2cc845c12edbbec7a
The text was updated successfully, but these errors were encountered: