@@ -40,17 +46,17 @@ export default function Layout() {
Hilla Public
- {state.user ? (
+ { state.user ? (
Hilla Authenticated
) : null}
- {state.user ? (
+ { hillaIsInRole ? (
Hilla User
) : null}
- {state.user ? (
+ { flowIsInRole ? (
Flow Admin
diff --git a/src/main/frontend/views/about.tsx b/src/main/frontend/views/about.tsx
index ae432c2..1e2bdc8 100644
--- a/src/main/frontend/views/about.tsx
+++ b/src/main/frontend/views/about.tsx
@@ -1,4 +1,9 @@
import { VerticalLayout } from "@vaadin/react-components/VerticalLayout.js";
+import type { ViewConfig } from "@vaadin/hilla-file-router/types.js";
+
+export const config: ViewConfig = {
+ loginRequired: true
+};
/**
* Hilla views that allows access only for authenticated users.
diff --git a/src/main/frontend/views/hilla.tsx b/src/main/frontend/views/hilla.tsx
index 01bdcf6..47b68eb 100644
--- a/src/main/frontend/views/hilla.tsx
+++ b/src/main/frontend/views/hilla.tsx
@@ -2,7 +2,13 @@ import { Button } from "@vaadin/react-components/Button.js";
import { TextField } from "@vaadin/react-components/TextField.js";
import { HelloEndpoint } from "Frontend/generated/endpoints";
import { useState } from "react";
-import {VerticalLayout} from "@vaadin/react-components/VerticalLayout.js";
+import { VerticalLayout } from "@vaadin/react-components/VerticalLayout.js";
+import type { ViewConfig } from "@vaadin/hilla-file-router/types.js";
+
+export const config: ViewConfig = {
+ loginRequired: true,
+ rolesAllowed: ['ROLE_USER'],
+};
/**
* Hilla view that allows access only for users with a role 'USER'