Skip to content

6411 Дьячков К.А. Лаб.2 Вар.2#103

Open
feelpainagain wants to merge 1 commit intoitsecd:mainfrom
feelpainagain:lab2
Open

6411 Дьячков К.А. Лаб.2 Вар.2#103
feelpainagain wants to merge 1 commit intoitsecd:mainfrom
feelpainagain:lab2

Conversation

@feelpainagain
Copy link
Copy Markdown

No description provided.

@AvtoBBus AvtoBBus self-requested a review April 9, 2026 13:46
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Чтобы избежать повторения кода создайте функцию, которая будет выполнять запрос на определённый url, что-то типо такого:

async function sendRequest(url, queryParams = {}, bodyParams = {}) {

    // тут нужно добавить все query и body параметры

    cosnt response = fetch(API_BASE + url);

    // обрабатываем ответ

    return result;
}

export async function getStations() {
    return await sendRequest('/endpoint-for-stations')
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Очень похожий код на то, что было у одного из ваших коллег, поэтому чтобы искупить такой проступок, задание такое:

Примерно с 167 строки у вас начинаются функции рендера различных вещей. Выносите всё это как отдельные компоненты в папке components/


return () => {
clearTimeout(timeout);
map.setTarget(undefined);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

В удалении таргета нет смысла

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Этот файл не нужно в гит

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

можно удалить

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Так же в добавлении к вышеописанному заданию: добавьте алиасы до необходимых папок

Comment on lines +55 to +62
const isRailway =
transportType.includes('поезд') ||
transportType.includes('электрич') ||
stationType.includes('станц') ||
stationType.includes('платформ') ||
stationType.includes('вокзал')

if (!isRailway) continue
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не самый надежный способ проверять, потому что есть esr_code

}
})

const PORT = 5001
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Тоже в .env

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не нужно в гит это

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.

2 participants