Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual a ordem das coisas? #43

Open
marcellopato opened this issue Sep 1, 2022 · 2 comments
Open

Qual a ordem das coisas? #43

marcellopato opened this issue Sep 1, 2022 · 2 comments

Comments

@marcellopato
Copy link

Opa, tudo bem?

Eu acho que não estou sabendo como montar o fluxo corretamente, podem me ajudar?

  1. Montei uma função do VueJS para ir buscar o Cookie e o Captcha:
			axios.post("/montaBuscaCNPJ", {
				cnpj: app.cnpj
			})
			.then(function(response) {
				app.captcha = response.data.captchaBase64
				console.log(response);
			});
		}

Essa rota manda para o EmpresaController@montaBuscaCNPJ assim:

public function montaBuscaCNPJ(Request $request)
    {
        $params = CnpjGratis::getParams($request->cnpj);
        return $params;
    }

O retorno do captcha devolvo para a tag de imagem assim:
<img :src="captcha" /><br />

Mas aí já começa o problema pois a tag não parece conter a source corretamente, como podem ver abaixo:

<img src="iVBORw0KGgoAAAANSUhEUgAAALQAAAAyCAYAAAD1JPH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABbCSURBVHhe3Z1ZzGVTFsc/lCGUeR6izETMFCJmMYTELKYyljFlJmalUaYYIyXaPJRERVNaFNqQaDwISQfxgKSTIv3Am4d+8NAPp+9v1/e/1l3f2mfvc79bQ/c/WanvnrOHtdf+r7XX3ufcW2NrrrnmP8fGxpr/N5k6deq/t9tuu0XItGnT/nXIIYf847TTTvs7MmvWrIVPP/30S5Kmaf40GaGN3377bY699uGHH861fcycOfNv6n/69OnfSa9I95JoXGpPfdj+h5Wff/75ge++++5hf33evHnP+WvR9Vy5yQp6MUb+je5LevYZa6ZMmRIablnITjvt1Bx66KET5MQTT2zuvPPOJKeffnrTI2jz2muvNZ988klfeqRqvv766+aLL77ojW0x+Ky233rrrfGro8OLL76Y2r7//vvHrwzi999/H9AP8K/+Fr7//vtUBh01To1d+tfIaqutNmCvp556aqBvD68L46GeBfVpm3sW/nqu3CjAPKKXndsIYzNmzPgYo//000/N888/37zzzjuJKDIoCm600Ubp3xpZeeWVm7333rs544wzUhsiXc6gwyAyOnj//ff7esioEETXmNxRg3Ghy6JFi8avDAKich957733mh9//DFNDtIVTCa2xHloD9IyR71Vtj/GNll11VWbffbZpzn55JNTfWzz7LPPDujCODxpmEPqP/bYY+NXFsNfz5VbGmAekkP1/iZUN/Pnz28uvfTSgcE888wzzRFHHNEn4y+//NK8+eabzQMPPNCccMIJSfltttmm2WSTTdLfNWKjBwYoeRx906/+1ueIEDgmxmTCpTOA3JCZ+8sSd911V7LxkoIILwfC1nvssUc4D17WWWedVP78889PdQkOsjF28zYF/nqu3NIAuqJ3n9AA7ySiCJG3CihNAzYyPfjgg30Dbb311ikaYChruJyQahxzzDGpTQjIxGAgRWP+Jpogy8Jgo0CbPUcBP3/YSbaaO3du39bMDeStDUQ4BXNz2223NU8++WSam+UVfULDcA0gl2tCqhKZIOCcOXOaTz/9NH3+9ttvm88//7yfI+LBN998c7VBN9xww2avvfZKKwJChIuicwl2ciN4MiwNyGlHATt/r776av+atRVzQ9D58ssvx68sBk5GRCZwXHbZZWluatIY5o+yzCcrI+Mp8cOCsqMavzDGrhFFMIIUtbkmnUpRbVhqUeMkpDXnnXde6pO2d9ttt36dNsGQ11xzTZqkmqjnJ9fC6vn66693mpQSaDvSD73pDwcfBexe4bjjjhu/+gdyejDW3Hg195qb7bffvll77bX7/eRklVVWSfODczA+2lDaKHCN1RtnGCXGLrzwwr9dffXVaSmBXD7XxBDcJ8fW8l8DjJFzEgufD9O38uCPPvoo9XnKKaekNkpRY//9909GVLSoxaOPPtpv4+ijj54wRnSiPeTXX3/t/10ifrRJFahLPzZlq0GOmIA+zj333JQaoJ/m0epx0003DehNe9b+bfj4448TDwA2VpusoDW5uvJ0SLz66quna1tttdVIo3SvzT863GGHHZKRMYAGz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+/FxCIJyO8Vli1YI6BDXqI6QNevuQc2l9HQ/hm/2QmLfscAZyZebKYhTOPkBoT4guYX8YlAbABKh/jF9CjnyMR2NaEqBfBFibcTw4DNC1Ji0R6JuNLPUIMtH8RbnrKFcL+mWVIuKXbE1ZeMbGj1+XFUoritAWEAYI7QnRNQJbY9agFK1szm3/e4WuYFxETSa9C1GGQVebeWATzvJrieYdKLds65yYjZ70qiVQDUrpoYXKEtHZF9RC42EcOE6EAUJTAc+pWbYjWGN2Bf3p1+wtosgCmPjaVMRO+pFHHlldL0KuX2yG/brA2xsiSE+OzXKgXC7o5KIu97iO/ssLSgHNA7vb/80hwgCh5TkIxycydundB4GjJb8RwuA1dfVtC0ta4CcMiX4vrw1qwz7BqqnnYQmn+rQdbaxqHM7am7Zr/hu8UhpYirrYL7dKtd3rgtpgU1MOneTwAHu3rX7ZTaE1Nst1m5EEDOyXkNqoXftEEj387+Xl4L0fXdrq0XZtCqT6XPMbK9pROREflJwb+/HbE0RnygJfh8/WwUvw9UlLos0qyEV3C9pq6zc3do8u5dCpNpJnCT0MmFgO5C1KRsI4eKA9JagB7dqjOA/axFiUs8jVK0U+gWhsCReNLyI+4DoPR3I64xC33377QHvUKZGsDbZ+aYz0XyIOBEMExqKVnLnLjd2jtlwt6B9dRkJoGtM3DHiyZFFaAkseGF2vWapqIz6TgI4YoybyeQLnxhc5DpERnWxq4oHeei8BRA7TBbZ+7RhrQH3mnVdq9Wal7BCNPYIvx7+kt13THtpZbNf7m/8Ci4pYxVlMmzEAAAAASUVORK5CYII=">
  1. A ideia aqui é fazer o usuário digitar o conteúdo dessa imagem do captcha e mandar para outro método no EmpresaController assim:
public function buscaCNPJ(Request $request)
    {
        $dadosEmpresa = CnpjGratis::consulta(
            $request->cnpj,
            $request->captchaBase64,
            $request->cookie
        );
        dd($dadosEmpresa);
    }

E alimentar a função VueJS com o response.data para preencher todos os campos do formulário com os dados da empresa.

Porém, não estou conseguindo. Podem me ajudar?

@luanlazzarin
Copy link

Opa, experimenta a tag img assim:

<img :src="'data:image/png;base64, '+captcha" />

@marcellopato
Copy link
Author

Thank's man @luanlazzarin! Funcionou perfeitamente. Agora o usuário tem a imagem captcha para ver e digitar em outro campo, para eu poder enviar para o próximo método, certo?
Muito obrigado!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants