diff --git a/src/components/EntityScaffold.res b/src/components/EntityScaffold.res
index ff304dd82..68afbe809 100644
--- a/src/components/EntityScaffold.res
+++ b/src/components/EntityScaffold.res
@@ -1,85 +1,32 @@
-module ComingSoon = {
- @react.component
- let make = (~title) => {
-
-
{React.string(title)}
-
{React.string("Coming soon...")}
-
- }
-}
-
-module ShowPage = {
- @react.component
- let make = (~entityName, ~id) => {
-
-
- {React.string(`Show ${entityName} `)}
- {React.string(`#${id}`)}
-
-
{React.string("Coming soon...")}
-
- }
-}
-
-module UnauthorizedPage = {
- @react.component
- let make = (~entityName) => {
-
-
{React.string(entityName)}
-
{React.string("You don't have access to this module. Contact admin for access")}
-
- }
-}
-
@react.component
let make = (
~entityName="",
~remainingPath,
~isAdminAccount=false,
~access: AuthTypes.authorization=Access,
- ~renderList=_ => ,
- ~renderNewForm=_ => ,
+ ~renderList,
+ ~renderNewForm=?,
~renderShow=?,
- ~renderOrder=?,
- ~renderEdit=_ => ,
- ~renderEditWithMultiId=(_, _) => ,
- ~renderClone=_ => ,
) => {
if access === NoAccess {
-
+
} else {
switch remainingPath {
| list{"new"} =>
switch access {
- | Access => renderNewForm()
- | NoAccess =>
- }
- | list{id, "clone"} =>
- switch access {
- | Access => renderClone(id)
- | NoAccess =>
+ | Access =>
+ switch renderNewForm {
+ | Some(element) => element()
+ | None => React.null
+ }
+ | NoAccess =>
}
| list{id} =>
let page = switch renderShow {
| Some(fn) => fn(id)
- | None =>
+ | None => React.null
}
page
- | list{id, "edit"} =>
- switch access {
- | Access => renderEdit(id)
- | NoAccess =>
- }
- | list{id1, id2, "edit"} =>
- switch access {
- | Access => renderEditWithMultiId(id1, id2)
- | NoAccess =>
- }
- | list{"order", id} =>
- switch renderOrder {
- | Some(fn) => fn(id)
- | None =>
- }
| list{} => renderList()
| _ =>
}
diff --git a/src/components/UnauthorizedPage.res b/src/components/UnauthorizedPage.res
new file mode 100644
index 000000000..55bddadc9
--- /dev/null
+++ b/src/components/UnauthorizedPage.res
@@ -0,0 +1,19 @@
+@react.component
+let make = (~message="You don't have access to this module. Contact admin for access") => {
+ let {setDashboardPageState} = React.useContext(GlobalProvider.defaultContext)
+ React.useEffect0(() => {
+ RescriptReactRouter.replace("/unauthorized")
+ None
+ })
+
+
+}
diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res
index 6e54d224a..f8d8e2979 100644
--- a/src/entryPoints/hyperswitch/HyperSwitchApp.res
+++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res
@@ -350,7 +350,7 @@ let make = () => {
| list{"quick-start"} => determineQuickStartPageState()
| list{"woocommerce"} => determineWooCommerce()
| list{"stripe-plus-paypal"} => determineStripePlusPayPal()
-
+ | list{"unauthorized"} =>
| _ =>
RescriptReactRouter.replace(`${hyperSwitchFEPrefix}/home`)