diff --git a/src/pages/Profile/Profile.jsx b/src/pages/Profile/Profile.jsx index e78f797..af3532a 100644 --- a/src/pages/Profile/Profile.jsx +++ b/src/pages/Profile/Profile.jsx @@ -6,7 +6,7 @@ import { useNavigate } from "react-router-dom"; import placeholder from "../../Images/placeholder.png"; import Loading from "../../components/Loading/Loading"; import { BlobServiceClient } from "@azure/storage-blob"; -import { MdDelete } from "react-icons/md"; +import { MdDelete } from "react-icons/md"; import { toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { toastStyles } from "../../toastConfig"; @@ -35,8 +35,11 @@ function Profile() { const fetchImages = async () => { try { setLoading(true); - const blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net`); - const containerClient = blobServiceClient.getContainerClient(containerName); + const blobServiceClient = new BlobServiceClient( + `https://${account}.blob.core.windows.net` + ); + const containerClient = + blobServiceClient.getContainerClient(containerName); const blobItems = containerClient.listBlobsFlat(); let urls = []; //returns an array of objects with name and url @@ -48,7 +51,9 @@ function Profile() { setLoading(false); // Find the URL for the specific user and set it to the state - const userImage = urls.find((url) => url.name === `${userData.user_id}.png`); + const userImage = urls.find( + (url) => url.name === `${userData.user_id}.png` + ); if (userImage) { setUserImageUrl(userImage.url); } else { @@ -72,7 +77,8 @@ function Profile() { `https://${account}.blob.core.windows.net/?${sasToken}` // Use the SAS token to authenticate ); //blobService Client is a class that allows us to interact with the blob storage - const containerClient = blobServiceClient.getContainerClient(containerName); // Get the container client used to interact with the container + const containerClient = + blobServiceClient.getContainerClient(containerName); // Get the container client used to interact with the container const blobClient = containerClient.getBlockBlobClient(blobName); // Get the blob client used to interact with the blob const result = await blobClient.uploadData(file, { blobHTTPHeaders: { blobContentType: file.type }, @@ -89,7 +95,9 @@ function Profile() { }; const deleteImage = async (blobName) => { - const blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net/?${sasToken}`); + const blobServiceClient = new BlobServiceClient( + `https://${account}.blob.core.windows.net/?${sasToken}` + ); const containerClient = blobServiceClient.getContainerClient(containerName); const blobClient = containerClient.getBlockBlobClient(blobName); try { @@ -114,7 +122,17 @@ function Profile() {