diff --git a/frontend/app/src/layouts/producer/AnonymousLayout.tsx b/frontend/app/src/layouts/producer/AnonymousLayout.tsx
index 4ef4949..10176d3 100644
--- a/frontend/app/src/layouts/producer/AnonymousLayout.tsx
+++ b/frontend/app/src/layouts/producer/AnonymousLayout.tsx
@@ -20,7 +20,7 @@ export default function AnonymousLayout() {
}
console.log('loadEnvironmentType')
loadEnvironmentType()
- }, [environmentTypeService])
+ }, [])
const Item = styled(Paper)(({ theme }) => ({
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
diff --git a/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx b/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
index 90c7dc5..340d180 100644
--- a/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
+++ b/frontend/app/src/layouts/producer/AuthenticatedLayout.tsx
@@ -19,7 +19,9 @@ export default function AuthenticatedLayout() {
const authenticationService = new AuthenticationService(keycloak)
const urlService = new UrlService()
- const {authenticatedAsCustomer, environmentType}: {isAuthenticatedAsCustomer: boolean, environmentType: {label: String, color: String} | undefined} = useLoaderData()
+ const data = useLoaderData()
+ const authenticatedAsCustomer: boolean = data.isAuthenticatedAsCustomer
+ const environmentType = data.environmentType
const sideMenuWidth = 240;
@@ -100,11 +102,11 @@ export default function AuthenticatedLayout() {
if (!authenticationService.isAuthenticated()) {
return
- } else if (authenticatedAsCustomer) {
+ }
+ if (authenticatedAsCustomer) {
return
- } else {
- return getAuthenticatedLayout()
}
+ return getAuthenticatedLayout()
}
export async function loadAuthenticatedLayoutData(keycloak): Promise<{isAuthenticatedAsCustomer: boolean, environmentType: {label: String, color: String} | undefined}> {