diff options
author | Sebastian <sebasjm@gmail.com> | 2023-09-21 10:31:10 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-09-25 14:50:41 -0300 |
commit | 062939d9cc016a186a282f7a48492c3e01cd740c (patch) | |
tree | a52c93ef1179ece9d8621731d4a34fc654f18713 /packages/demobank-ui/src/components | |
parent | b3c747151bb3f50d28bf6205cafa4b7dd6ae2b1c (diff) | |
download | wallet-core-062939d9cc016a186a282f7a48492c3e01cd740c.tar.xz |
admin refactor
Diffstat (limited to 'packages/demobank-ui/src/components')
-rw-r--r-- | packages/demobank-ui/src/components/Routing.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/demobank-ui/src/components/Routing.tsx b/packages/demobank-ui/src/components/Routing.tsx index 890058a9b..ef11af76e 100644 --- a/packages/demobank-ui/src/components/Routing.tsx +++ b/packages/demobank-ui/src/components/Routing.tsx @@ -19,14 +19,14 @@ import { VNode, h } from "preact"; import { Route, Router, route } from "preact-router"; import { useEffect } from "preact/hooks"; import { BankFrame } from "../pages/BankFrame.js"; -import { BusinessAccount } from "../pages/BusinessAccount.js"; +import { BusinessAccount } from "../pages/business/Home.js"; import { HomePage, WithdrawalOperationPage } from "../pages/HomePage.js"; import { PublicHistoriesPage } from "../pages/PublicHistoriesPage.js"; import { RegistrationPage } from "../pages/RegistrationPage.js"; import { Test } from "../pages/Test.js"; import { useBackendContext } from "../context/backend.js"; import { LoginForm } from "../pages/LoginForm.js"; -import { AdminPage } from "../pages/AdminPage.js"; +import { AdminHome } from "../pages/admin/Home.js"; export function Routing(): VNode { const history = createHashHistory(); @@ -34,6 +34,7 @@ export function Routing(): VNode { if (backend.state.status === "loggedOut") { return <BankFrame + account={undefined} goToBusinessAccount={() => { route("/business"); }} @@ -63,7 +64,7 @@ export function Routing(): VNode { </Router> </BankFrame> } - const isAdmin = backend.state.isUserAdministrator + const { isUserAdministrator, username } = backend.state return ( <BankFrame @@ -108,14 +109,15 @@ export function Routing(): VNode { <Route path="/account" component={() => { - if (isAdmin) { - return <AdminPage + if (isUserAdministrator) { + return <AdminHome onRegister={() => { route("/register"); }} />; } else { return <HomePage + account={username} onPendingOperationFound={(wopid) => { route(`/operation/${wopid}`); }} @@ -130,6 +132,7 @@ export function Routing(): VNode { path="/business" component={() => ( <BusinessAccount + account={username} onClose={() => { route("/account"); }} |