Skip to content

Commit e0cbecc

Browse files
committed
Updating logic to check admins in firebase
1 parent cdaf0fb commit e0cbecc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

web/src/components/predictions/leaderboard.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import UpdateScore from "./update-score";
77

88
// generate leaderboard
99
const Leaderboard = ({ user }) => {
10+
const [admin, adminLoading, adminError] = useObject(
11+
firebase.database().ref("admins/" + user.uid)
12+
);
13+
1014
const [names, namesLoading, namesError] = useObject(
1115
firebase.database().ref("public")
1216
);
@@ -99,7 +103,7 @@ const Leaderboard = ({ user }) => {
99103
)}
100104
<Spacer height={3} />
101105
{/*if user.uid matches below, then a button is rendered that allows for updating all scores*/}
102-
{user.uid === process.env.ADMIN_USER && <UpdateScore />}
106+
{!adminError && !adminLoading && admin && <UpdateScore />}
103107
</div>
104108
);
105109
};

0 commit comments

Comments
 (0)