diff --git a/app/routes/dashboard.tsx b/app/routes/dashboard.tsx index e05cf4a..78b38e8 100644 --- a/app/routes/dashboard.tsx +++ b/app/routes/dashboard.tsx @@ -1,11 +1,12 @@ import { getAuth } from "@clerk/remix/ssr.server"; import { LoaderFunction, redirect } from "@remix-run/node"; import { Link } from "@remix-run/react"; -import { LogInIcon, TrashIcon } from "lucide-react"; +import { LogInIcon, ShieldIcon, TrashIcon } from "lucide-react"; import { useState } from "react"; import LoadingIndicator from "~/components/LoadingIndicator"; import { useEventSource } from "remix-utils/sse/react"; -import { useAuth } from "@clerk/remix"; +import { useUser } from "@clerk/remix"; +import { isAdmin, isVIP } from "~/services/helpers"; export const loader: LoaderFunction = async (args) => { const { userId } = await getAuth(args); @@ -36,8 +37,8 @@ type RoomsResponse = | undefined; export default function Dashboard() { - const { userId } = useAuth(); - let roomsFromDb = useEventSource("/api/room/get/all", { event: userId! }); + const { user, isLoaded } = useUser(); + let roomsFromDb = useEventSource("/api/room/get/all", { event: user?.id! }); let roomsFromDbParsed = JSON.parse(roomsFromDb!) as RoomsResponse; @@ -107,6 +108,16 @@ export default function Dashboard() { +