aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/App.tsx
blob: 52c86c273808f108fc4effb2748442c1e8bbebdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { TranslationProvider } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact";
import { ExchangeAmlFrame } from "./Dashboard.js";
import "./scss/main.css";
import { ExchangeApiProvider } from "./context/config.js";
import { getInitialBackendBaseURL } from "./hooks/useBackend.js";
import { Router } from "./route.js";
import { Pages } from "./pages.js";

const pageList = Object.values(Pages);


export function App(): VNode {
  const baseUrl = getInitialBackendBaseURL();
  return (
    <TranslationProvider source={{}}>
      <ExchangeApiProvider baseUrl={baseUrl} frameOnError={ExchangeAmlFrame}>
        <ExchangeAmlFrame>
          <Router
            pageList={pageList}
            onNotFound={() => {
              window.location.href = Pages.cases.url
              return <div>not found</div>;
            }}
          />
        </ExchangeAmlFrame>
      </ExchangeApiProvider>
    </TranslationProvider>
  );
}