commit 7fb9bb8fa0ebbc05411a0fbbc799ce4e1bf0e4a7
parent bed0ebb449a3427b58a007cb1cf0e9f03baf2736
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 17 May 2021 16:57:28 -0300
fix about currency being hard coded
Diffstat:
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/packages/frontend/src/paths/instance/reserves/create/CreatePage.tsx b/packages/frontend/src/paths/instance/reserves/create/CreatePage.tsx
@@ -24,6 +24,7 @@ import { useState } from "preact/hooks";
import { FormErrors, FormProvider } from "../../../../components/form/FormProvider";
import { Input } from "../../../../components/form/Input";
import { InputCurrency } from "../../../../components/form/InputCurrency";
+import { useConfigContext } from "../../../../context/config";
import { MerchantBackend } from "../../../../declaration";
import { Translate, useTranslator } from "../../../../i18n";
@@ -36,14 +37,16 @@ interface Props {
export function CreatePage({ onCreate, onBack }: Props): VNode {
+ const { currency } = useConfigContext()
+
const [reserve, setReserve] = useState<Partial<Entity>>({
- initial_balance: 'COL:2',
+ initial_balance: `${currency}:2`,
exchange_url: 'http://exchange.taler:8081/',
wire_method: 'x-taler-bank',
})
const i18n = useTranslator()
- const errors : FormErrors<Entity> = {
+ const errors: FormErrors<Entity> = {
}
diff --git a/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx b/packages/frontend/src/paths/instance/transfers/create/CreatePage.tsx
@@ -25,6 +25,7 @@ import { FormErrors, FormProvider } from "../../../../components/form/FormProvid
import { Input } from "../../../../components/form/Input";
import { InputCurrency } from "../../../../components/form/InputCurrency";
import { InputWithAddon } from "../../../../components/form/InputWithAddon";
+import { useConfigContext } from "../../../../context/config";
import { MerchantBackend } from "../../../../declaration";
import { Translate, useTranslator } from "../../../../i18n";
import { CROCKFORD_BASE32_REGEX, URL_REGEX } from "../../../../utils/constants";
@@ -38,14 +39,15 @@ interface Props {
export function CreatePage({ onCreate, onBack }: Props): VNode {
const i18n = useTranslator()
+ const { currency } = useConfigContext()
const [state, setState] = useState<Partial<Entity>>({
wtid: 'DCMGEM7F0DPW930M06C2AVNC6CFXT6HBQ2YVQH7EC8ZQ0W8SS9TG',
payto_uri: 'payto://x-taler-bank/bank.taler:5882/blogger',
exchange_url: 'http://exchange.taler:8081/',
- credit_amount: 'COL:22.80'
- })
-
+ credit_amount: `${currency}:22.80`,
+ });
+
const errors: FormErrors<Entity> = {
wtid: !state.wtid ? i18n`cannot be empty` :
(!CROCKFORD_BASE32_REGEX.test(state.wtid) ? i18n`check the id, doest look valid` :