Last active
June 18, 2020 14:04
-
-
Save SomtoUgeh/29a6331192fc3c33a2232905ddb73f50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add new identifiers here */ | |
enum AppModuleView { | |
DASHBOARD = "DASHBOARD", | |
PROFILE = "PROFILE", | |
FAQ = "FAQ", | |
SETTINGS = "SETTINGS" | |
} | |
/* .env, pass in completed/availble feature identifier here */ | |
COMPLETED_MODULES=[DASHBOARD, PROFILE, FAQ, SETTINGS] | |
/* APP_ROUTES, pass identifier to routes */ | |
const AppRoutes = [ | |
{ | |
path: "/", | |
exact: true, | |
component: Dashboard, | |
module: AppModuleView.DASHBOARD | |
}, | |
{ | |
path: "/faqs", | |
exact: true, | |
component: FAQs, | |
module: AppModuleView.FAQ | |
}, | |
{ | |
path: "/profile", | |
exact: true, | |
component: Profile, | |
module: AppModuleView.PROFILE | |
} | |
]; | |
/* RENDERED ROUTES, only available features indicated in .env will be rendered */ | |
const APP_MODULES = process.env.COMPLETED_MODULES; | |
const Routes = AppRoutes.filter( | |
({ module }) => { | |
if (module && APP_MODULES) return APP_MODULES.includes(module); | |
else return; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment