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

Issue regards message dispaly when click on product screen #52

Open
Manjulajntuk opened this issue Apr 17, 2021 · 1 comment
Open

Issue regards message dispaly when click on product screen #52

Manjulajntuk opened this issue Apr 17, 2021 · 1 comment

Comments

@Manjulajntuk
Copy link

No description provided.

@Manjulajntuk
Copy link
Author

app.js
import HomeScreen from './screens/HomeScreen.js'
import ProductScreen from './screens/ProductScreen.js'
import { parseRequestUrl } from './utils.js';
import Error404Screen from './screens/Error404Screen.js'
const routes = {
'/': HomeScreen,
'/product/:id': ProductScreen,

};
const router = () => {
const request = parseRequestUrl();
const parseUrl = (request.resource ?
/${request.resource}:/)+ (request.id ? '/:id': '' )+
(request.verb ? /${request.verb}:'');
const screen =
routes[parseUrl]? routes[parseUrl]: Error404Screen;
const main= document.getElementById("main-container");
main.innerHTML = screen.render();
};
window.addEventListener('load',router);
window.addEventListener('hashchange',router);

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

No branches or pull requests

1 participant