File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
apps/dashboard/src/@/constants Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 1- const LOGGED_IN_ONLY_PATHS = [
2- // anything that _starts_ with /dashboard is logged in only
3- "/dashboard" ,
4- // team pages are logged in only
5- "/team" ,
6- // anything that _starts_ with /cli is logged in only
7- "/cli" ,
8- // publish page
9- "/contracts/publish" ,
10- ] ;
11-
121export function isLoginRequired ( pathname : string ) {
13- return LOGGED_IN_ONLY_PATHS . some ( ( path ) => pathname . startsWith ( path ) ) ;
2+ // remove '/' in front and then split by '/'
3+ const paths = pathname . slice ( 1 ) . split ( "/" ) ;
4+
5+ // /dashboard, /team, /cli
6+ if ( paths [ 0 ] === "dashboard" || paths [ 0 ] === "team" || paths [ 0 ] === "cli" ) {
7+ return true ;
8+ }
9+
10+ // /contracts/publish
11+ if ( paths [ 0 ] === "contracts" && paths [ 1 ] === "publish" ) {
12+ return true ;
13+ }
14+
15+ return false ;
1416}
You can’t perform that action at this time.
0 commit comments