async function fetchTextInCard()

in components/register-new-user-with-idcard.tsx [162:193]


async function fetchTextInCard(imageBytesb64: string, props: RegNewUserWithIdCardProps, dispatch: Dispatch<RegUserAction>) {
    let input = {
        imageDataBase64: imageBytesb64
    };

    dispatch({ type: 'pastableText', payload: '' });
    dispatch({ type: 'showCardTextButton', payload: 'false' });

    try {
        // https://dev.to/rmuhlfeldner/how-to-use-an-aws-amplify-graphql-api-with-a-react-typescript-frontend-2g79
        const { data } = await callGraphQLWithSimpleInput<DetecttextinidcardQuery>(
            {
                query: detecttextinidcard,
                authMode: GRAPHQL_AUTH_MODE.AMAZON_COGNITO_USER_POOLS,
                variables: input
            }
        );

        if (data?.detecttextinidcard?.DetectedText &&
            data.detecttextinidcard.DetectedText.length > 0) {
            var pastableText = '';
            for (var i = 0; i < data.detecttextinidcard.DetectedText.length; i++) {
                pastableText = pastableText + data.detecttextinidcard.DetectedText[i] + "|";
            }

            dispatch({ type: 'pastableText', payload: pastableText });
            dispatch({ type: 'showCardTextButton', payload: 'true' });
        }
    }
    catch (errors) {
    }
}