mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 12:19:16 +00:00
improvement: better variable names in ModalImageCors
This commit is contained in:
@@ -19,7 +19,7 @@ const useStyles = makeStyles(theme => ({
|
|||||||
const ModalImageCors = ({ imageUrl }) => {
|
const ModalImageCors = ({ imageUrl }) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [fetching, setFetching] = useState(true);
|
const [fetching, setFetching] = useState(true);
|
||||||
const [url, setUrl] = useState("");
|
const [blobUrl, setBlobUrl] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!imageUrl) return;
|
if (!imageUrl) return;
|
||||||
@@ -27,10 +27,10 @@ const ModalImageCors = ({ imageUrl }) => {
|
|||||||
const { data, headers } = await api.get(imageUrl, {
|
const { data, headers } = await api.get(imageUrl, {
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
const blobUrl = window.URL.createObjectURL(
|
const url = window.URL.createObjectURL(
|
||||||
new Blob([data], { type: headers["content-type"] })
|
new Blob([data], { type: headers["content-type"] })
|
||||||
);
|
);
|
||||||
setUrl(blobUrl);
|
setBlobUrl(url);
|
||||||
setFetching(false);
|
setFetching(false);
|
||||||
};
|
};
|
||||||
fetchImage();
|
fetchImage();
|
||||||
@@ -39,9 +39,9 @@ const ModalImageCors = ({ imageUrl }) => {
|
|||||||
return (
|
return (
|
||||||
<ModalImage
|
<ModalImage
|
||||||
className={classes.messageMedia}
|
className={classes.messageMedia}
|
||||||
smallSrcSet={fetching ? imageUrl : url}
|
smallSrcSet={fetching ? imageUrl : blobUrl}
|
||||||
medium={fetching ? imageUrl : url}
|
medium={fetching ? imageUrl : blobUrl}
|
||||||
large={fetching ? imageUrl : url}
|
large={fetching ? imageUrl : blobUrl}
|
||||||
alt="image"
|
alt="image"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user