Skip to content

Commit

Permalink
feat: Localities Search demo v1
Browse files Browse the repository at this point in the history
  • Loading branch information
lpernelle-woosmap committed Jan 7, 2025
1 parent 27cead3 commit c4f9559
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion samples/localities-search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let input: string;
let detailsHTML: HTMLElement;
let addressDetailsContainer: HTMLElement;

const woosmap_key = "YOUR_API_KEY";

// @ts-nocheck
function initMap(): void {
map = new window.woosmap.map.Map(
Expand All @@ -29,7 +31,7 @@ const fetchLocalitiesSearch = async (input: any): Promise<any> => {
try {
const response = await fetch(
`
https://api.woosmap.com/localities/search?types=point_of_interest|locality|admin_level|postal_code|address&input=${encodeURIComponent(input)}&location=${center.lat()},${center.lng()}&radius=100000&key=woos-f3399eaa-1f01-33cd-a0db-ce1e23b7320d&components=country%3Agb`
https://api.woosmap.com/localities/search?types=point_of_interest|locality|admin_level|postal_code|address&input=${encodeURIComponent(input)}&location=${center.lat()},${center.lng()}&radius=${radius}&key=${woosmap_key}&components=country%3Agb`
);
return await response.json();
} catch (error) {
Expand All @@ -38,6 +40,7 @@ https://api.woosmap.com/localities/search?types=point_of_interest|locality|admin
}
};

// @ts-nocheck
function fillAddressDetails(
addressDetails: woosmap.map.localities.LocalitiesDetailsResult
) {
Expand Down

0 comments on commit c4f9559

Please sign in to comment.