Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Oct 26, 2024
1 parent 75303c8 commit a4e2be9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions web/src/app/admin/connectors/[connector]/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@ import { UserRole } from "@/lib/types";
function BackButton({
isAdmin,
isCurator,
user,
}: {
isAdmin: boolean;
isCurator: boolean;
user: User | null;
}) {
const buttonText = isAdmin ? "Admin Page" : "Curator Page";

if (!isAdmin && !isCurator) {
console.error(
"User is neither admin nor curator, defaulting to curator view"
`User is neither admin nor curator, defaulting to curator view. Found user:\n ${JSON.stringify(
user,
null,
2
)}`
);
}

Expand All @@ -42,7 +48,7 @@ export default function Sidebar() {
const { formStep, setFormStep, connector, allowAdvanced, allowCreate } =
useFormContext();
const combinedSettings = useContext(SettingsContext);
const { isCurator, isAdmin } = useUser();
const { isCurator, isAdmin, user } = useUser();
if (!combinedSettings) {
return null;
}
Expand Down Expand Up @@ -84,7 +90,7 @@ export default function Sidebar() {
</div>
</div>

<BackButton isAdmin={isAdmin} isCurator={isCurator} />
<BackButton isAdmin={isAdmin} isCurator={isCurator} user={user} />

<div className="h-full flex">
<div className="mx-auto w-full max-w-2xl px-4 py-8">
Expand Down

0 comments on commit a4e2be9

Please sign in to comment.