diff options
author | Florian Dold <florian@dold.me> | 2022-10-15 12:59:26 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-15 12:59:26 +0200 |
commit | bd88dcebbcf90414c790a86ee13740eaf20e3334 (patch) | |
tree | 3faa7508089bfa4316aebb310a7a5cf55076db34 /packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts | |
parent | e075134ffc94fda3582b179122bda594d91a962b (diff) | |
download | wallet-core-bd88dcebbcf90414c790a86ee13740eaf20e3334.tar.xz |
wallet-core: simplify exchanges list response
Diffstat (limited to 'packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts b/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts index 5766883ae..a106c3d85 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { GetExchangeTosResult } from "@gnu-taler/taler-util"; +import { ExchangeTosStatus, GetExchangeTosResult } from "@gnu-taler/taler-util"; export function buildTermsOfServiceState( tos: GetExchangeTosResult, @@ -24,26 +24,7 @@ export function buildTermsOfServiceState( tos.content, ); - const status: TermsStatus = buildTermsOfServiceStatus( - tos.content, - tos.acceptedEtag, - tos.currentEtag, - ); - - return { content, status, version: tos.currentEtag }; -} -export function buildTermsOfServiceStatus( - content: string | undefined, - acceptedVersion: string | undefined, - currentVersion: string | undefined, -): TermsStatus { - return !content - ? "notfound" - : !acceptedVersion - ? "new" - : acceptedVersion !== currentVersion - ? "changed" - : "accepted"; + return { content, status: tos.tosStatus, version: tos.currentEtag }; } function parseTermsOfServiceContent( @@ -91,12 +72,10 @@ function parseTermsOfServiceContent( export type TermsState = { content: TermsDocument | undefined; - status: TermsStatus; + status: ExchangeTosStatus; version: string; }; -type TermsStatus = "new" | "accepted" | "changed" | "notfound"; - export type TermsDocument = | TermsDocumentXml | TermsDocumentHtml |