Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RSS-ECOMM-3_19): implement routing for all pages #215

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/app/App/model/AppModel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-lines-per-function */
import type { Page } from '@/shared/types/common.ts';

import RouterModel from '@/app/Router/model/RouterModel.ts';
Expand All @@ -22,10 +23,26 @@ class AppModel {

private createRoutes(): Promise<Map<string, () => Promise<Page>>> {
const routesMap = {
[PAGE_ID.ABOUT_US_PAGE]: async (): Promise<Page> => {
const { default: AbooutUsPageModel } = await import('@/pages/AboutUsPage/model/AboutUsPageModel.ts');
return new AbooutUsPageModel(this.appView.getHTML());
},
[PAGE_ID.CART_PAGE]: async (): Promise<Page> => {
const { default: CartPageModel } = await import('@/pages/CartPage/model/CartPageModel.ts');
return new CartPageModel(this.appView.getHTML());
},
[PAGE_ID.CATALOG_PAGE]: async (): Promise<Page> => {
const { default: CatalogPageModel } = await import('@/pages/CatalogPage/model/CatalogPageModel.ts');
return new CatalogPageModel(this.appView.getHTML());
},
[PAGE_ID.DEFAULT_PAGE]: async (): Promise<Page> => {
const { default: MainPageModel } = await import('@/pages/MainPage/model/MainPageModel.ts');
return new MainPageModel(this.appView.getHTML());
},
[PAGE_ID.ITEM_PAGE]: async (): Promise<Page> => {
const { default: ItemPageModel } = await import('@/pages/ItemPage/model/ItemPageModel.ts');
return new ItemPageModel(this.appView.getHTML());
},
[PAGE_ID.LOGIN_PAGE]: async (): Promise<Page> => {
const { default: LoginPageModel } = await import('@/pages/LoginPage/model/LoginPageModel.ts');
return new LoginPageModel(this.appView.getHTML(), this.router);
Expand All @@ -44,6 +61,10 @@ class AppModel {
);
return new RegistrationPageModel(this.appView.getHTML(), this.router);
},
[PAGE_ID.USER_PROFILE_PAGE]: async (): Promise<Page> => {
const { default: UserProfilePageModel } = await import('@/pages/UserProfilePage/model/UserProfilePageModel.ts');
return new UserProfilePageModel(this.appView.getHTML());
},
};

const routes = new Map<string, () => Promise<Page>>();
Expand Down
Loading