mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 05:07:46 +00:00
Merge pull request #38 from Y4ELX/fix-profile-own-detection
fix: refactor user role checks in ProfileLayout
This commit is contained in:
commit
8c12a835a6
1 changed files with 4 additions and 4 deletions
|
|
@ -42,11 +42,11 @@ export default function ProfileLayout() {
|
|||
return <div className="p-6 text-center">Loading...</div>;
|
||||
}
|
||||
|
||||
const currentUser = user ?? $session?.user;
|
||||
const sessionUserId = $session?.user?.id ? Number($session.user.id) : null;
|
||||
const page = location.pathname;
|
||||
const isAdmin = currentUser?.id === Number(import.meta.env.VITE_ADMIN_USER_ID);
|
||||
const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(user?.id);
|
||||
const isOwnProfile = currentUser?.id === user?.id;
|
||||
const isAdmin = sessionUserId === Number(import.meta.env.VITE_ADMIN_USER_ID);
|
||||
const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(String(user?.id));
|
||||
const isOwnProfile = sessionUserId === user?.id;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue