Skip to content

Commit

Permalink
feat: created a util to see if auth user is a mod
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeallencook committed Nov 27, 2023
1 parent 4399a3b commit 0094f31
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/utils/is-user-moderator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import OrganizationInterface from '@interfaces/organization';

const isUserModerator = (
uid: string,
myOrganizations: string[],
organizations: { [key: string]: OrganizationInterface }
) => {
for (const organization of myOrganizations) {
if (organizations?.[organization]?.moderators.includes(uid)) {
return true;
}
}
return false;
};

export default isUserModerator;

0 comments on commit 0094f31

Please # to comment.