/*
This file is part of GNU Taler
(C) 2022-2024 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see
*/
import {
urlPattern,
useCurrentLocation,
useNavigationContext,
useTranslationContext,
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { assertUnreachable } from "@gnu-taler/taler-util";
import { useEffect } from "preact/hooks";
import { ExchangeAmlFrame } from "./ExchangeAmlFrame.js";
import { useOfficer } from "./hooks/officer.js";
import { Cases } from "./pages/Cases.js";
import { Officer } from "./pages/Officer.js";
import { CaseDetails } from "./pages/CaseDetails.js";
import { CaseUpdate, SelectForm } from "./pages/CaseUpdate.js";
import { HandleAccountNotReady } from "./pages/HandleAccountNotReady.js";
export function Routing(): VNode {
const session = useOfficer();
if (session.state === "ready") {
return (
);
}
return (
);
}
const publicPages = {
config: urlPattern(/\/config/, () => "#/config"),
login: urlPattern(/\/login/, () => "#/login"),
};
function PublicRounting(): VNode {
const { i18n } = useTranslationContext();
const location = useCurrentLocation(publicPages);
// const { navigateTo } = useNavigationContext();
// const { config, lib } = useExchangeApiContext();
// const [notification, notify, handleError] = useLocalNotification();
const session = useOfficer();
if (location === undefined) {
if (session.state !== "ready") {
return ;
} else {
return
}
}
switch (location.name) {
case "config": {
return (