Skip to content

Commit

Permalink
fix(RapidHandout): require employee perm to view page
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianAndersen committed Aug 23, 2024
1 parent 5c17655 commit d5c8901
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/RapidHandout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UserDetail } from "@boklisten/bl-model";
import { Alert, Button } from "@mui/material";
import { useState } from "react";

import { isLoggedIn } from "@/api/auth";
import { isEmployee, isLoggedIn } from "@/api/auth";
import DynamicLink from "@/components/DynamicLink";
import RapidHandoutDetails from "@/components/RapidHandoutDetails";
import UserDetailSearchField from "@/components/search/UserDetailSearchField";
Expand All @@ -13,7 +13,7 @@ export default function RapidHandout() {
const hydrated = useIsHydrated();
const [customer, setCustomer] = useState<UserDetail | null>(null);

return hydrated && isLoggedIn() ? (
return hydrated && isLoggedIn() && isEmployee() ? (
<>
<UserDetailSearchField
onSelectedResult={(userDetail) => {
Expand All @@ -25,7 +25,7 @@ export default function RapidHandout() {
) : (
<>
<Alert sx={{ mt: 2 }} severity="info">
Du må logge inn som administrator for å bruke denne siden.
Du må ha ansattilgang for å bruke denne siden.
</Alert>
<DynamicLink href={"/auth/login?redirect=admin/hurtigutdeling"}>
<Button variant={"contained"} sx={{ mt: 2 }}>
Expand Down

0 comments on commit d5c8901

Please sign in to comment.