UPDATE: User page allows for profile image upload if on their own profile

This commit is contained in:
JustIceO7
2025-02-28 00:37:25 +00:00
parent 2b325746f5
commit 6e4a14c5b6
4 changed files with 94 additions and 20 deletions

View File

@@ -0,0 +1,24 @@
import { useEffect, useState } from "react"
export function useSameUser({ username }: { username: string | undefined }) {
const [isSame, setIsSame] = useState(false);
useEffect(() => {
const fetchStatus = async () => {
try {
const response = await fetch(`/api/user/same/${username}`);
if (!response.ok) {
throw new Error("Failed to validate user");
}
const data = await response.json();
setIsSame(data.same);
} catch (error) {
console.error("Error:", error);
}
};
fetchStatus();
}, []);
return isSame;
}