forked from Iniciativa-PRO/portfolio-lilita
-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.js
31 lines (25 loc) · 883 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
import { home } from "/page/home/index.js"
import { notfound } from "/page/notfound/index.js"
import { collaborations } from "/page/collaborations/index.js"
import { artsplastiques } from "/page/artsplastiques/index.js"
import { designgraphique } from "/page/designgraphique/index.js"
import { formatricedespagnol } from "/page/formatricedespagnol/index.js"
const routes = {
'home': home(),
'collaborations': collaborations(),
'artsplastiques': artsplastiques(),
'designgraphique': designgraphique(),
'formatricedespagnol': formatricedespagnol()
}
export function router(){
var url = new URL(window.location.href);
var data = url.searchParams.get("page")
if(routes.hasOwnProperty(data) || data == null){
if(data == null){
return routes.home
}
return routes[data]
} else{
return notfound()
}
}