aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-04-03 15:31:28 -0300
committerSebastian <sebasjm@gmail.com>2024-04-03 15:31:28 -0300
commitc7e68c254aa93778b8201227d6db1ac57e081e81 (patch)
treeb5d34651a8d17180826dcd4f09bb808f2f080b21 /packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx
parent4bf1ab8ba924b2a0fc4813814bdeeb66a2928382 (diff)
downloadwallet-core-c7e68c254aa93778b8201227d6db1ac57e081e81.tar.xz
wip #8655: unauthorized not documented
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx
index 6dc5b9b02..de3ffce48 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { OperationOk, TalerError, TalerMerchantApi, TalerMerchantInstanceHttpClient } from "@gnu-taler/taler-util";
+import { HttpStatusCode, TalerError, TalerMerchantApi, TalerMerchantInstanceHttpClient, TalerMerchantManagementResultByMethod, assertUnreachable } from "@gnu-taler/taler-util";
import {
useMerchantApiContext,
useTranslationContext
@@ -29,6 +29,7 @@ import {
useManagedInstanceDetails,
} from "../../../hooks/instance.js";
import { Notification } from "../../../utils/types.js";
+import { LoginPage } from "../../login/index.js";
import { UpdatePage } from "./UpdatePage.js";
export interface Props {
@@ -62,7 +63,7 @@ function CommonUpdate(
onBack,
onConfirm,
}: Props,
- result: OperationOk<TalerMerchantApi.QueryInstancesResponse> | TalerError | undefined,
+ result: TalerMerchantManagementResultByMethod<"getInstanceDetails"> | TalerError | undefined,
updateInstance: typeof TalerMerchantInstanceHttpClient.prototype.updateCurrentInstance,
): VNode {
const [notif, setNotif] = useState<Notification | undefined>(undefined);
@@ -73,6 +74,16 @@ function CommonUpdate(
if (result instanceof TalerError) {
return <ErrorLoadingMerchant error={result} />
}
+ if (result.type === "fail") {
+ switch(result.case) {
+ case HttpStatusCode.Unauthorized: {
+ return <LoginPage />
+ }
+ default: {
+ assertUnreachable(result.case)
+ }
+ }
+ }
return (
<Fragment>