From 6bc24055cd5a79d59d2b56c7e767ac1b30d99fff Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Sun, 1 Jun 2025 08:41:12 +0200 Subject: [PATCH] fix: load the school image eorrectly --- Front-End/next.config.mjs | 9 ++++-- Front-End/src/components/ProfileSelector.js | 31 +++++++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Front-End/next.config.mjs b/Front-End/next.config.mjs index 095c420..cc678bb 100644 --- a/Front-End/next.config.mjs +++ b/Front-End/next.config.mjs @@ -5,6 +5,9 @@ const pkg = require('./package.json'); const withNextIntl = createNextIntlPlugin(); +const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080'; +const apiUrlObj = new URL(apiUrl); + /** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', @@ -19,9 +22,9 @@ const nextConfig = { hostname: 'www.gravatar.com', }, { - protocol: 'http', - hostname: 'localhost', - port: '8080', + protocol: apiUrlObj.protocol.replace(':', ''), + hostname: apiUrlObj.hostname, + ...(apiUrlObj.port ? { port: apiUrlObj.port } : {}), }, ], }, diff --git a/Front-End/src/components/ProfileSelector.js b/Front-End/src/components/ProfileSelector.js index 761368a..25fde35 100644 --- a/Front-End/src/components/ProfileSelector.js +++ b/Front-End/src/components/ProfileSelector.js @@ -128,22 +128,20 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
{user?.email}
- {selectedEstablishment?.name - ? `${selectedEstablishment.name}` - : ''} + {selectedEstablishment?.name || ''}
{getRightStr(selectedEstablishment?.role_type) || ''}
@@ -167,12 +165,17 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => { ...establishments.map((establishment) => ({ type: 'item', label: ( -
-
- {getRightStr(establishment.role_type)} -
-
- {establishment.name} +
+ Profile +
+
{establishment.name}
+
{getRightStr(establishment.role_type)}
),