김시환

Merge branch 'main' into 'main'

move selectAddress



See merge request !5
import fetch from "node-fetch";
globalThis.fetch = fetch;
var currAddress = new Array();
function getAdddress(currQuery) {
var AddressList = new Array();
function getAddress(currQuery) {
fetch('https://dapi.kakao.com/v2/local/search/address.json?' + new URLSearchParams({
query: currQuery
}), {
......@@ -11,17 +13,42 @@ function getAdddress(currQuery) {
})
.then(response => response.json())
.then(data => {
currAddress = data.documents.map(({road_address})=>({road_address}));
AddressList = data.documents.map(({road_address})=>({road_address}));
// console.log(currAddress)
return currAddress
return AddressList
})
}
function selectAddress(addressArray, number) {
/*
move to Line
var x; var y;
var regions = new Array();
// addressArray <- return value from function getAddress
function selectAddress(addressArray, number) {
x = addressArray[number].road_address.x
y = addressArray[number].road_address.y
regions.region_1depth_name = addressArray[number].road_address.region_1depth_name;
regions.region_2depth_name = addressArray[number].road_address.region_2depth_name;
regions.region_3depth_name = addressArray[number].road_address.region_3depth_name;
}
function getXY() {
*/
// hospitals: array from hospital API
// addNum: index of addressArray
function getXY(hospitals, addNum) {
AddressList = null;
}
module.exports = {getAddress, selectAddress, getXY};
\ No newline at end of file
module.exports = {getAddress, getXY};
\ No newline at end of file
......