diff --git a/src/app/_components/drivercomponents/driver-dashboard.tsx b/src/app/_components/drivercomponents/driver-dashboard.tsx index 5afea1f..5e97b4a 100644 --- a/src/app/_components/drivercomponents/driver-dashboard.tsx +++ b/src/app/_components/drivercomponents/driver-dashboard.tsx @@ -20,7 +20,7 @@ export const DriverDashboard = () => { let driverTrips = [{}] as Booking[]; - const tripQuery = api.bookings.getDriverTrip.useQuery( + const tripQuery = api.bookings.getAll.useQuery( { startDate: dateJSON.startDate, endDate: dateJSON.endDate, diff --git a/src/app/_components/drivercomponents/surveyButtons/surveyButtons.tsx b/src/app/_components/drivercomponents/surveyButtons/surveyButtons.tsx index 1df7665..6b6af8f 100644 --- a/src/app/_components/drivercomponents/surveyButtons/surveyButtons.tsx +++ b/src/app/_components/drivercomponents/surveyButtons/surveyButtons.tsx @@ -4,6 +4,7 @@ import { Group, Stack } from "@mantine/core"; import { useState } from "react"; import Button from "@/app/_components/common/button/Button"; import SurveyNotification from "@/app/_components/drivercomponents/surveyNotification/surveyNotification"; +import { authClient } from "@/lib/auth-client"; import { api } from "@/trpc/react"; import type { Booking, Survey } from "@/types/types"; @@ -19,6 +20,7 @@ export default function SurveyViewToggle({ initialSurveys, }: SurveyViewToggleProps) { const [activeView, setActiveView] = useState("pending"); + const { data: session } = authClient.useSession(); // will update every 60 seconds const { data: surveys = [] } = api.surveys.getAll.useQuery(undefined, { diff --git a/src/server/api/routers/bookings.ts b/src/server/api/routers/bookings.ts index 0e3cada..35a8c5d 100644 --- a/src/server/api/routers/bookings.ts +++ b/src/server/api/routers/bookings.ts @@ -148,7 +148,7 @@ export const bookingsRouter = createTRPCRouter({ conditions.push(eq(bookings.surveyCompleted, input.surveyCompleted)); } - if (role === "admin") { + if (role === "admin" || role === "driver") { return ctx.db .select() .from(bookings)