remove profile picture link verification
continuous-integration/drone/push Build is passing Details

maxime 1 year ago
parent dbf6e888cf
commit 59ebcf9e71

@ -211,13 +211,6 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
className={"settings-button"} className={"settings-button"}
onClick={async () => { onClick={async () => {
const url = urlRef.current!.value const url = urlRef.current!.value
const exists = await imageExists(url)
setErrorMessages([
"Le lien ne renvoie vers aucune image !",
])
if (!exists) {
return
}
const errors = await updateAccount(fetcher, { const errors = await updateAccount(fetcher, {
profilePicture: url, profilePicture: url,
}) })
@ -236,18 +229,3 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
</div> </div>
) )
} }
async function imageExists(imageLink: string) {
try {
const response = await fetch(imageLink, { mode: "no-cors" })
if (response.ok) {
const contentType = response.headers.get("Content-type")
return contentType?.startsWith("image/") ?? false
}
return false
} catch (error) {
console.error(error)
return false
}
}

Loading…
Cancel
Save