-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathroutelist.ts
38 lines (34 loc) · 1.11 KB
/
routelist.ts
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
import { parseUrl } from '../url'
const PUBLIC_ROUTELIST_REGEXES = [
/^\/login$/,
/^\/benefit(\/.+)?$/,
/^\/regions\/[^/]+\/(attractions|restaurants|articles)\/[^/]+$/,
/^\/regions\/[^/]+\/hotels(\/.*)?$/,
/^\/(attractions|restaurants|hotels|articles)\/[^/]+$/,
/^\/hotels\/?$/,
/^\/hotels\/list(\/.+)?$/,
/^\/hotels\/curation(\/.+)?$/,
/^\/hotels\/[^/]+\/rate(\/.+?)?$/,
/^\/hotels\/[^/]+\/breakdown(\/.+?)?$/,
/^(\/hotels)?\/regions\/[^/]+\/hotel-areas$/,
/^\/air\/?$/,
/^\/air\/curation(\/.+)?$/,
/^\/air\/price-board(\/.+)?$/,
/^\/tna(\?.+)?$/,
/^\/tna\/curation(\/.+)?$/,
/^\/tna\/regions\/[^/]+\/products(\/.+)?$/,
/^\/tna\/products(\/.+)?$/,
/^\/tna\/products\/[^/]+\/display$/,
/^\/trips\/intro(\/.*)?(\?.*)?$/,
/^\/trips\/lounge\/itineraries\/[^/]+$/,
/^\/trips\/promotion\/customized-schedule(\/.*)?$/,
/^\/trips\/plan(\/.*)?$/,
/^\/reviews\/list(\/.*)?$/,
]
export function checkIfRoutable({ href }: { href: string }) {
const { host, path } = parseUrl(href)
if (!host && path) {
return PUBLIC_ROUTELIST_REGEXES.some((regex) => path.match(regex))
}
return true
}