Skip to content

Instantly share code, notes, and snippets.

View tonghoangvu's full-sized avatar

Vu Tong tonghoangvu

View GitHub Profile
@tonghoangvu
tonghoangvu / index.js
Created December 27, 2022 15:26
Load image blob by Fetch API
const img = document.getElementById('img')
const JWT = 'ey...'
const API_URL = 'http://localhost:8080'
const IMG_NAME = 'ABC.png'
// https://stackoverflow.com/a/50248437/13779659
fetch(`${API_URL}/secure-images/${IMG_NAME}`, {
headers: {
Authorization: `Bearer ${JWT}`