summaryrefslogtreecommitdiff
path: root/packages/frontend/src/paths/instance/update/UpdatePage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/paths/instance/update/UpdatePage.tsx')
-rw-r--r--packages/frontend/src/paths/instance/update/UpdatePage.tsx30
1 files changed, 4 insertions, 26 deletions
diff --git a/packages/frontend/src/paths/instance/update/UpdatePage.tsx b/packages/frontend/src/paths/instance/update/UpdatePage.tsx
index 4a965b6..0fa96ed 100644
--- a/packages/frontend/src/paths/instance/update/UpdatePage.tsx
+++ b/packages/frontend/src/paths/instance/update/UpdatePage.tsx
@@ -35,8 +35,6 @@ import { Amounts } from "@gnu-taler/taler-util";
type Entity = MerchantBackend.Instances.InstanceReconfigurationMessage & {
- payto_uris_base: string[], // field to construct final payto URI
- creditor_name: string, // name of the receiver for the payto URI
auth_token?: string
}
@@ -56,19 +54,8 @@ function convert(from: MerchantBackend.Instances.QueryInstancesResponse): Entity
default_wire_fee_amortization: 1,
default_pay_delay: { d_ms: 1000 * 60 * 60 }, //one hour
default_wire_transfer_delay: { d_ms: 1000 * 60 * 60 * 2 }, //two hours
- creditor_name: '',
- payto_uris_base: new Array<string>()
}
- if (payto_uris && payto_uris.length > 0) {
- const payto = new URL(payto_uris[0])
- defaults.creditor_name = payto.searchParams.get('receiver-name') || ''
- defaults.payto_uris_base = payto_uris.map( p => {
- const payto = new URL(p)
- payto.searchParams.delete('receiver-name')
- return payto.toString()
- })
- }
- return { ...defaults, ...rest, payto_uris: [] };
+ return { ...defaults, ...rest, payto_uris };
}
function getTokenValuePart(t?: string): string | undefined {
@@ -103,10 +90,9 @@ export function UpdatePage({ onUpdate, onChangeAuth, selected, onBack }: Props):
const errors: FormErrors<Entity> = {
name: !value.name ? i18n`required` : undefined,
- creditor_name: !value.creditor_name ? i18n`required` : undefined,
- payto_uris_base:
- !value.payto_uris_base || !value.payto_uris_base.length ? i18n`required` : (
- undefinedIfEmpty(value.payto_uris_base.map(p => {
+ payto_uris:
+ !value.payto_uris || !value.payto_uris.length ? i18n`required` : (
+ undefinedIfEmpty(value.payto_uris.map(p => {
return !PAYTO_REGEX.test(p) ? i18n`is not valid` : undefined
}))
),
@@ -144,14 +130,6 @@ export function UpdatePage({ onUpdate, onChangeAuth, selected, onBack }: Props):
const hasErrors = Object.keys(errors).some(k => (errors as any)[k] !== undefined)
const submit = async (): Promise<void> => {
- const receiverName = value.creditor_name!
- value.payto_uris = value.payto_uris_base?.map(p => {
- const payto = new URL(p)
- payto.searchParams.set('receiver-name', receiverName)
- return payto.toString()
- }) || []
- value.payto_uris_base = undefined
-
await onUpdate(schema.cast(value));
await onBack()
return Promise.resolve()