Skip to content

Conversation

@otus-learning
Copy link
Owner

No description provided.

@github-actions
Copy link

You can check this code at CodeSandbox with the link
https://githubbox.com/otus-learning/otus-learning/tree/homeworkForLection14

src/script/ui.js Outdated

//request to geocoder
export async function getCoordinates(city) {
let response = await window.fetch(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем window?

src/script/ui.js Outdated

//request to weather provider
async function getWeather(lat, lon) {
let url =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

использовать шаблонную строку

src/script/ui.js Outdated
"%2C" +
(Number(lat) + 0.05);
iframe.src += prjConst.MAP_URL_END;
showWeather(await getWeather(lat, lon));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

обернуть в try catch

src/script/ui.js Outdated
let showWeather = (weather) => {
let main = weather.list[0].main;
let temp = main.temp;
if (isNaN(temp)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенести в функцию showError

src/script/ui.js Outdated

export let createStyledElement = (tag, style, id) => {
let el = document.createElement(tag);
style !== null && (el.className = style);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style && (el.className = style);

url = url.replace(prjConst.GEOCODER_URL_START, "");
url = url.replace(prjConst.GEOCODER_URL_END, "");

return new Promise((resolve) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otus-learning added a commit that referenced this pull request Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants