root

Merge branch 'main' into sihwan

...@@ -6,22 +6,30 @@ globalThis.fetch = fetch.fetch; ...@@ -6,22 +6,30 @@ globalThis.fetch = fetch.fetch;
6 var AddressList = new Array(); 6 var AddressList = new Array();
7 7
8 8
9 -function getAddress(currQuery) { 9 +function getAddress(currQuery, cb = ()=> {}) {
10 + setTimeout(function () {
10 fetch('https://dapi.kakao.com/v2/local/search/address.json?' + new URLSearchParams({ 11 fetch('https://dapi.kakao.com/v2/local/search/address.json?' + new URLSearchParams({
11 query: currQuery 12 query: currQuery
12 }), { 13 }), {
13 method: "GET", 14 method: "GET",
14 - headers: {"Authorization": "KakaoAK c14234ba46c574c73715276c5644f397"} 15 + headers: { "Authorization": "KakaoAK c14234ba46c574c73715276c5644f397" }
15 }) 16 })
16 .then(response => response.json()) 17 .then(response => response.json())
17 .then(data => { 18 .then(data => {
18 - console.log(response) 19 + //console.log(response)
19 - AddressList = data.documents.map(({road_address})=>({road_address})); 20 + AddressList = data.documents.map(({ road_address }) => ({ road_address }));
20 - console.log(AddressList) 21 + //console.log(AddressList)
21 - return AddressList 22 + cb(AddressList);
22 - }) 23 + });
24 +
25 + },100)
23 } 26 }
24 27
28 +/*
29 +getAddress('석수동길', function (address) {
30 + console.log(address[0].road_address.address_name);
31 +})
32 +*/
25 33
26 34
27 35
......