better profile photo update logic

This commit is contained in:
Daniel
2023-06-08 17:09:22 +03:30
parent 39abb09002
commit dcdef77387
5 changed files with 31 additions and 53 deletions
+3 -3
View File
@@ -11,14 +11,14 @@ export default function ProfilePhoto({ src, className }: Props) {
const [error, setError] = useState(false);
useEffect(() => {
console.log(src);
}, []);
setError(false);
}, [src]);
return error || !src ? (
<div
className={`bg-sky-500 text-white h-10 w-10 shadow rounded-full border-[3px] border-slate-200 flex items-center justify-center ${className}`}
>
<FontAwesomeIcon icon={faUser} className="w-5 h-5" />
<FontAwesomeIcon icon={faUser} className="w-1/2 h-1/2" />
</div>
) : (
<img