forked from htmlacademy-ecmascript/2253825-big-trip-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
44 lines (34 loc) · 1.3 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import MainPresenter from './presenter/main-presenter.js';
import HeaderPresenter from './presenter/header-presenter.js';
import TripApiService from './service/trip-api-service.js';
import { ApiServiceConnector } from './const.js';
import PointsModel from './model/points-model.js';
import FilterModel from './model/filters-model.js';
import FormStateModel from './model/form-state-model.js';
const siteBodyElement = document.querySelector('.page-header');
const siteTripInfo = siteBodyElement.querySelector('.trip-main');
const siteFilters = siteBodyElement.querySelector('.trip-controls__filters');
const siteMainElement = document.querySelector('.page-main');
const tripMainEvents = siteMainElement.querySelector('.trip-events');
const pointsModel = new PointsModel({
tripApiService: new TripApiService(ApiServiceConnector.END_POINT,
ApiServiceConnector.AUTHORIZATION)
});
const filterModel = new FilterModel;
const formStateModel = new FormStateModel;
const mainPresenter = new MainPresenter({
tripMainContainer: tripMainEvents,
pointsModel,
filterModel,
formStateModel
});
const headerPresenter = new HeaderPresenter({
tripInfoContainer: siteTripInfo,
tripFilterContainer: siteFilters,
pointsModel,
filterModel,
formStateModel
});
pointsModel.init();
headerPresenter.init();
mainPresenter.init();