P
Size: a a a
P
А
async function addressFunctionJson(address, callbackFunction = (data, error) => {
debugger
if (error !== null) {
return alert('Упс! Что то пошло не так. Повторите попытку позже')
}
resultSearchJsonData(data)
}) {
const http = 'https://maps.googleapis.com/maps/api/geocode/json?address='
let requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch(`${http}${address}&key=${credentials.mapKey}`, requestOptions)
.then(response => response.text())
.then(result => callbackFunction(result, null)
)
.catch(error => callbackFunction(null, error));
}А
P
P
async function addressFunctionJson(address:string, callbackFunction = (data: any, error: any) => {
debugger
if (error !== null) {
return alert('Упс! Что то пошло не так. Повторите попытку позже')
}
resultSearchJsonData(data)
}) {
const http = 'https://maps.googleapis.com/maps/api/geocode/json?address='
let requestOptions = {
method: 'GET',
redirect: 'follow'
};
try {
const response = await fetch(`${http}${address}&key=${credentials.mapKey}`, requestOptions)
const text = await response.text();
callbackFunction(text, null);
} catch(error) {
callbackFunction(null, error)
}
}P
А
(data: any, error: any) ?А
P
(data: any, error: any) ?P
async function addressFunctionJson(address) {
const http = 'https://maps.googleapis.com/maps/api/geocode/json?address='
let requestOptions = {
method: 'GET',
redirect: 'follow'
};
try {
const response = await fetch(`${http}${address}&key=${credentials.mapKey}`, requestOptions)
const text = await response.text();
return text;
} catch(error) {
throw error;
}
}
async function exec() {
const text = await addressFunctionJson("address");
}А
async function addressFunctionJson(address) {
const http = 'https://maps.googleapis.com/maps/api/geocode/json?address='
let requestOptions = {
method: 'GET',
redirect: 'follow'
};
try {
const response = await fetch(`${http}${address}&key=${credentials.mapKey}`, requestOptions)
const text = await response.text();
return text;
} catch(error) {
throw error;
}
}
async function exec() {
const text = await addressFunctionJson("address");
}DT
RB
P
А
async function addressFunctionJson(address) {
const http = 'https://maps.googleapis.com/maps/api/geocode/json?address='
let requestOptions = {
method: 'GET',
redirect: 'follow'
};
try {
const response = await fetch(`${http}${address}&key=${credentials.mapKey}`, requestOptions)
const text = await response.text();
return text;
} catch(error) {
throw error;
}
}
async function exec() {
const text = await addressFunctionJson("address");
}P
C
P
S
IL