-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.js
39 lines (35 loc) · 981 Bytes
/
router.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
import renderMain from "./pages/main/main.js";
import renderAbout from "./pages/about/about.js";
import renderMovies from "./pages/movies/movies.js";
import renderScreenings from "./pages/screenings/screenings.js";
import renderTickets from "./pages/tickets/tickets.js";
import renderCustomer from "./pages/customer/customer.js";
import renderEmployee from "./pages/employee/employee.js";
export default function () {
window.router = new Navigo("/", {hash: true});
router
.on({
"/": () => {
renderMain().then(router.updatePageLinks);
},
about: () => {
renderAbout();
},
movies: () => {
renderMovies();
},
"/tickets":() => {
renderScreenings().then(router.updatePageLinks);
},
"/tickets/:id":({data}) => { //data is object = {id: #idnumber}
renderTickets(data.id);
},
customer: () => {
renderCustomer();
},
employee: () => {
renderEmployee();
},
})
.resolve();
}