Archived
Merge branch 'master' of https://github.com/makoteq/eco-hack
This commit is contained in:
commit
c5e2a54c81
2 files changed
+9
-1
No files matched your search
+1
-1
@@ -12,7 +12,7 @@
|
||||
<body>
|
||||
<div id="root">
|
||||
<div style="width: 100vw; height: 100vh; position: absolute; top: 0; left: 0; display: flex; justify-content: center; align-items: center">
|
||||
<img src="leaf.svg" alt="eco-meet logo" style="width: 15%; height: 15%" />
|
||||
<img src="%PUBLIC_URL%/leaf.svg" alt="eco-meet logo" style="width: 15%; height: 15%" />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import axios from "axios";
|
||||
|
||||
export const getPlace = async (pos) => {
|
||||
if (!Array.isArray(pos) || isNaN(pos[0]) || isNaN(pos[1])) throw new TypeError("Incorrect argument type");
|
||||
const rq = await axios.get(`https://nominatim.openstreetmap.org/reverse?lat=${pos[1]}&lon=${pos[0]}&format=json&polygon_geojson=1&addressdetails=1`);
|
||||
if (rq.status !== 200) throw new Error(`Request failed with status code ${rq.status}: ${rq.statusText}`);
|
||||
return rq.data.address;
|
||||
};
|
||||
Reference in new issue
Block a user