I made a POST request to get a QRCode Here is the data I get from the response. The preview of the response works fine only I don't know how to use this data to display it in a tag on my html page for example. Any ideas?
Asked
Active
Viewed 546 times
-1
-
is this helpful? https://stackoverflow.com/questions/16449445/how-can-i-set-image-source-with-base64 – Erfan Yeganegi Sep 05 '21 at 10:25
-
`data` is base64? – Alireza Ahmadi Sep 05 '21 at 10:25
-
**DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob Sep 05 '21 at 10:44
-
@ErfanYeganegi @(Alireza Ahmadi) no I don't think it's a base64 data, and I already tried to put the data in the src of an
– sapristi12 Sep 05 '21 at 10:50
-
@Rob You can't see the whole data of the response, furthermore the QrCode is cut **BUT THANK YOU for looking after my safety, I appreciate** – sapristi12 Sep 05 '21 at 10:51
1 Answers
1
It finally works as : (in async function)
const response = await fetch(URL_FOR_QRCODE, //your own url
{
method: "POST", //because my endpoint is a post method
credentials: 'include' //because I use cookies (its a auth qr code)
});
this.QRCodeSRC = URL.createObjectURL(await response.blob());

sapristi12
- 82
- 9