Skip to content

Commit fdb67d7

Browse files
authored
Merge pull request #295 from HarvardOpenData/kh-admin-update
Update to use firebase admin list
2 parents cdaf0fb + 458a188 commit fdb67d7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

web/src/components/predictions/leaderboard.js

Lines changed: 6 additions & 2 deletions
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
);
@@ -98,8 +102,8 @@ const Leaderboard = ({ user }) => {
98102
</Box>
99103
)}
100104
<Spacer height={3} />
101-
{/*if user.uid matches below, then a button is rendered that allows for updating all scores*/}
102-
{user.uid === process.env.ADMIN_USER && <UpdateScore />}
105+
{/*if user.uid matches any admin uid, then a button is rendered that allows for updating all scores*/}
106+
{!adminError && !adminLoading && admin && <UpdateScore />}
103107
</div>
104108
);
105109
};

0 commit comments

Comments
 (0)