Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod Release 11/7 #485

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions booking-app/components/src/client/routes/components/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ApproverLevel, TableNames } from "@/components/src/policy";
import React, { createContext, useEffect, useMemo, useState } from "react";
import {
AdminUser,
Approver,
Expand All @@ -12,12 +14,10 @@ import {
SafetyTraining,
Settings,
} from "../../../types";
import { ApproverLevel, TableNames } from "@/components/src/policy";
import React, { createContext, useEffect, useMemo, useState } from "react";

import { clientFetchAllDataFromCollection } from "@/lib/firebase/firebase";
import { fetchAllFutureBooking } from "@/components/src/server/db";
import { useAuth } from "@/components/src/client/routes/components/AuthProvider";
import { fetchAllFutureBooking } from "@/components/src/server/db";
import { clientFetchAllDataFromCollection } from "@/lib/firebase/firebase";

export interface DatabaseContextType {
adminUsers: AdminUser[];
Expand Down Expand Up @@ -97,12 +97,19 @@ export const DatabaseProvider = ({
if (!userEmail) return PagePermission.BOOKING;
if (adminUsers.map((admin) => admin.email).includes(userEmail))
return PagePermission.ADMIN;
console.log("liaisonUsers", liaisonUsers);
console.log("userEmail", userEmail);
console.log(
"liaisonUsers.map((liaison) => liaison.email).includes(userEmail)",
liaisonUsers.map((liaison) => liaison.email).includes(userEmail)
);
if (liaisonUsers.map((liaison) => liaison.email).includes(userEmail)) {
return PagePermission.LIAISON;
} else if (paUsers.map((pa) => pa.email).includes(userEmail))
return PagePermission.PA;
else return PagePermission.BOOKING;
}, [userEmail, adminUsers, paUsers]);
}, [userEmail, adminUsers, paUsers, liaisonUsers]);
console.log("pagePermission", pagePermission);

useEffect(() => {
if (!bookingsLoading) {
Expand Down
Loading