This commit is contained in:
Sebastian 2023-04-07 18:59:47 -03:00
parent cfe7129c4e
commit 877a4bb132
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 7 additions and 8 deletions

View File

@ -255,19 +255,18 @@ function ErrorBanner({
function StatusBanner(): VNode | null { function StatusBanner(): VNode | null {
const [info, setInfo] = useState<TranslatedString>(); const [info, setInfo] = useState<TranslatedString>();
const [error, setError] = useState<ErrorMessage>(); const [error, setError] = useState<ErrorMessage>();
console.log("render", info, error);
function listenError(e: ErrorMessage) { function listenError(e: ErrorMessage) {
setError(e); setError(e);
} }
function listenInfo(m: TranslatedString) { function listenInfo(m: TranslatedString) {
console.log("update info", m, info);
setInfo(m); setInfo(m);
} }
useEffect(() => { useEffect(() => {
console.log("sadasdsad", infoListeners.length); /**
* Refactor this to reuse the pattern observable/listener
*/
errorListeners.push(listenError); errorListeners.push(listenError);
infoListeners.push(listenInfo); infoListeners.push(listenInfo);
console.log("sadasdsad", infoListeners.length);
return function unsuscribe() { return function unsuscribe() {
const idx = infoListeners.findIndex((d) => d === listenInfo); const idx = infoListeners.findIndex((d) => d === listenInfo);
if (idx !== -1) { if (idx !== -1) {
@ -277,7 +276,6 @@ function StatusBanner(): VNode | null {
if (idx2 !== -1) { if (idx2 !== -1) {
errorListeners.splice(idx2, 1); errorListeners.splice(idx2, 1);
} }
console.log("unload", idx);
}; };
}, []); }, []);
return ( return (

View File

@ -96,8 +96,10 @@ export function WithdrawalOperationPage({
onLoadNotOk: () => void; onLoadNotOk: () => void;
onAbort: () => void; onAbort: () => void;
}): VNode { }): VNode {
//FIXME: libeufin sandbox should return show to create the integration api endpoint
//or return withdrawal uri from response
const uri = stringifyWithdrawUri({ const uri = stringifyWithdrawUri({
bankIntegrationApiBaseUrl: getInitialBackendBaseURL(), bankIntegrationApiBaseUrl: `${getInitialBackendBaseURL()}/integration-api`,
withdrawalOperationId: operationId, withdrawalOperationId: operationId,
}); });
const parsedUri = parseWithdrawUri(uri); const parsedUri = parseWithdrawUri(uri);

View File

@ -67,7 +67,6 @@ export function WithdrawalQRCode({
) { ) {
return <div>operation not found</div>; return <div>operation not found</div>;
} }
console.log("result", result);
onLoadNotOk(); onLoadNotOk();
return handleNotOkResult(i18n)(result); return handleNotOkResult(i18n)(result);
} }
@ -77,7 +76,7 @@ export function WithdrawalQRCode({
if (data.aborted || data.confirmation_done) { if (data.aborted || data.confirmation_done) {
// signal that this withdrawal is aborted // signal that this withdrawal is aborted
// will redirect to account info // will redirect to account info
notifyInfo(i18n.str`Operation was completed from other session`); notifyInfo(i18n.str`Operation completed`);
onAborted(); onAborted();
return <Loading />; return <Loading />;
} }