aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-webui
diff options
context:
space:
mode:
Diffstat (limited to 'packages/anastasis-webui')
-rw-r--r--packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx2
-rw-r--r--packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx7
-rw-r--r--packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx13
-rw-r--r--packages/anastasis-webui/src/pages/home/SolveScreen.tsx5
-rw-r--r--packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx5
13 files changed, 21 insertions, 51 deletions
diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
index c14365d24..501415c40 100644
--- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx
@@ -19,7 +19,7 @@ export function AttributeEntryScreen(): VNode {
const [attrs, setAttrs] = useState<Record<string, string>>(
currentIdentityAttributes,
);
- const isBackup = state && state.backup_state;
+ const isBackup = state?.reducer_type === "backup";
const [askUserIfSure, setAskUserIfSure] = useState(false);
if (!reducer) {
diff --git a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx
index 17987796f..f0cf9b88c 100644
--- a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx
@@ -30,10 +30,7 @@ export function AuthenticationEditorScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
const configuredAuthMethods: AuthMethod[] =
@@ -62,7 +59,7 @@ export function AuthenticationEditorScreen(): VNode {
const authAvailableSet = new Set<string>();
for (const provKey of Object.keys(providers)) {
const p = providers[provKey];
- if ("http_status" in p && !("error_code" in p) && p.methods) {
+ if (p.status === "ok") {
for (const meth of p.methods) {
authAvailableSet.add(meth.type);
}
diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx
index d6272d843..cbdfcdce7 100644
--- a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx
@@ -9,10 +9,7 @@ export function BackupFinishedScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
const details = reducer.currentReducerState.success_details;
diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
index f24478d19..11001194a 100644
--- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx
@@ -55,10 +55,7 @@ export function ChallengeOverviewScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "recovery") {
return <div>invalid state</div>;
}
diff --git a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx
index ffcc8fafc..2e14f44cf 100644
--- a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx
@@ -7,10 +7,7 @@ export function ChallengePayingScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "recovery") {
return <div>invalid state</div>;
}
const payments = [""]; //reducer.currentReducerState.payments ??
diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
index 4e0dc2906..a57f7b08b 100644
--- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
@@ -38,10 +38,7 @@ export function EditPoliciesScreen({
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
index c3568b32d..2b2096dab 100644
--- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx
@@ -7,10 +7,7 @@ export function PoliciesPayingScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
const payments = reducer.currentReducerState.policy_payment_requests ?? [];
diff --git a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx
index d83482559..326a9a59d 100644
--- a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx
@@ -18,10 +18,7 @@ export function RecoveryFinishedScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "recovery") {
return <div>invalid state</div>;
}
const secretName = reducer.currentReducerState.recovery_document?.secret_name;
diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
index 4253f4617..5d75d5aaa 100644
--- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
@@ -15,10 +15,7 @@ export function ReviewPoliciesScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
index d9bf084ab..0931f4069 100644
--- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
@@ -27,10 +27,7 @@ export function SecretEditorScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
diff --git a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx
index 84f0303fe..45d8e46f3 100644
--- a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx
@@ -31,7 +31,7 @@ export function SecretSelectionScreen(): VNode {
if (
!reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
+ reducer.currentReducerState.reducer_type !== "recovery"
) {
return <div>invalid state</div>;
}
@@ -73,14 +73,17 @@ export function SecretSelectionScreen(): VNode {
}
return (
- <AnastasisClientFrame title="Recovery: Select secret" hideNext="Please select version to recover">
+ <AnastasisClientFrame
+ title="Recovery: Select secret"
+ hideNext="Please select version to recover"
+ >
<p>Found versions:</p>
{policies.map((x) => (
<div>
{x.policy_hash} / {x.secret_name}
<button
onClick={async () => {
- await reducer.transition("change_version", {
+ await reducer.transition("select_version", {
selection: x,
});
}}
@@ -119,7 +122,7 @@ export function OldSecretSelectionScreen(): VNode {
}
if (
!reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
+ reducer.currentReducerState.reducer_type !== "recovery"
) {
return <div>invalid state</div>;
}
@@ -127,7 +130,7 @@ export function OldSecretSelectionScreen(): VNode {
async function doSelectVersion(p: string, n: number): Promise<void> {
if (!reducer) return Promise.resolve();
return reducer.runTransaction(async (tx) => {
- await tx.transition("change_version", {
+ await tx.transition("select_version", {
version: n,
provider_url: p,
});
diff --git a/packages/anastasis-webui/src/pages/home/SolveScreen.tsx b/packages/anastasis-webui/src/pages/home/SolveScreen.tsx
index c695b9b22..1070cf8a9 100644
--- a/packages/anastasis-webui/src/pages/home/SolveScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SolveScreen.tsx
@@ -135,10 +135,7 @@ export function SolveScreen(): VNode {
</AnastasisClientFrame>
);
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.recovery_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "recovery") {
return (
<AnastasisClientFrame hideNav title="Recovery problem">
<div>invalid state</div>
diff --git a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx
index 6f95fa93b..c6f8cbead 100644
--- a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx
@@ -7,10 +7,7 @@ export function TruthsPayingScreen(): VNode {
if (!reducer) {
return <div>no reducer in context</div>;
}
- if (
- !reducer.currentReducerState ||
- reducer.currentReducerState.backup_state === undefined
- ) {
+ if (reducer.currentReducerState?.reducer_type !== "backup") {
return <div>invalid state</div>;
}
const payments = reducer.currentReducerState.payments ?? [];