diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx index be74729eb..8a39cf0e4 100644 --- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx @@ -1,9 +1,17 @@ import { h, VNode } from "preact"; -import { BackupReducerProps, AnastasisClientFrame } from "./index"; - -export function PoliciesPayingScreen(props: BackupReducerProps): VNode { - const payments = props.backupState.policy_payment_requests ?? []; +import { useAnastasisContext } from "../../context/anastasis"; +import { AnastasisClientFrame } from "./index"; +export function PoliciesPayingScreen(): VNode { + const reducer = useAnastasisContext() + if (!reducer) { + return <div>no reducer in context</div> + } + if (!reducer.currentReducerState || reducer.currentReducerState.backup_state === undefined) { + return <div>invalid state</div> + } + const payments = reducer.currentReducerState.policy_payment_requests ?? []; + return ( <AnastasisClientFrame hideNext title="Backup: Recovery Document Payments"> <p> @@ -19,7 +27,7 @@ export function PoliciesPayingScreen(props: BackupReducerProps): VNode { ); })} </ul> - <button onClick={() => props.reducer.transition("pay", {})}> + <button onClick={() => reducer.transition("pay", {})}> Check payment status now </button> </AnastasisClientFrame> |