project start date: 13.02.2024
get images from api and create blob url ⬇
const getImages = async (fileName) => {
try {
const cartImage = await fetch(`http://127.0.0.1:8000/files/${fileName}`)
const blob = await cartImage.blob()
const imageObjectURL = URL.createObjectURL(blob)
return imageObjectURL
} catch (error) {
console.log(error)
}
}
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh