Last active
January 9, 2024 19:37
-
-
Save alcir-junior-caju/0e521c633a4e8ab360dd89f7a740ba17 to your computer and use it in GitHub Desktop.
Download Image external Upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch(url) | |
.then(response => response.blob()) | |
.then(blob => { | |
const file = new File([blob], name, { type: 'image/*' }); | |
dispatch({ | |
type: 'SET_IMAGE', | |
payload: { | |
...data, | |
imageUrl: url, | |
image: file, | |
}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment