remove profile picture link verification

pull/118/head
maxime 1 year ago
parent 42c0300ced
commit d6f1a633a1

@ -211,13 +211,6 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
className={"settings-button"}
onClick={async () => {
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, {
profilePicture: url,
})
@ -236,18 +229,3 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) {
</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