feat: added Modal and router function
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// import 'bootstrap'; // ohne Pfadangabe (Modul auslesen aus node_modules) funktioniert nur mit JS-Bundler (esbuild, rollup & co.)
|
||||
|
||||
import ProductManager from './modules/ProductManager'; // Dateiendung kann weggelassen werden, wenn ein Bundler eingesetzt wird (esbuild, webpack, rollup, etc.)
|
||||
|
||||
(() => {
|
||||
@@ -6,9 +8,8 @@ import ProductManager from './modules/ProductManager'; // Dateiendung kann wegge
|
||||
|
||||
// === INIT =============
|
||||
const init = () => {
|
||||
// TODO: routing
|
||||
const pm = ProductManager();
|
||||
console.log('init');
|
||||
router();
|
||||
};
|
||||
|
||||
// === EVENTHANDLER =====
|
||||
@@ -16,6 +17,26 @@ import ProductManager from './modules/ProductManager'; // Dateiendung kann wegge
|
||||
// === XHR/FETCH ========
|
||||
|
||||
// === FUNCTIONS ========
|
||||
const router = () => {
|
||||
const path = window.location.pathname;
|
||||
|
||||
console.log(path);
|
||||
|
||||
switch (path) {
|
||||
case '/':
|
||||
case '/index.html':
|
||||
console.log('HOME');
|
||||
// nur Skripte, die für Home relevant ausführen
|
||||
break;
|
||||
case '/projects/product-manager.html':
|
||||
console.log('PRODUCT_MANAGER');
|
||||
|
||||
const pm = ProductManager();
|
||||
break;
|
||||
default:
|
||||
console.warn('Page not found');
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user