diff --git a/public/locales/de/translations.json b/public/locales/de/translations.json
index 2128b848..c55ce687 100644
--- a/public/locales/de/translations.json
+++ b/public/locales/de/translations.json
@@ -973,6 +973,10 @@
"deleteConfirmTitle": "Anerkennung löschen?",
"deleteConfirmText": "\"{{entryType}}\" Anerkennungseintrag wird dauerhaft gelöscht."
},
+ "profile": {
+ "loading": "Profil wird geladen...",
+ "notSetUp": "Ihr Organisationsprofil ist noch nicht eingerichtet — bitte schließen Sie die Registrierung ab."
+ },
"agentProfile": {
"agentProfile": "Einrichtungs-/Projektprofil",
"registeredSince": "Registriert seit",
diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json
index 57a336e6..7220053e 100644
--- a/public/locales/en/translations.json
+++ b/public/locales/en/translations.json
@@ -972,6 +972,10 @@
"deleteConfirmTitle": "Delete appreciation?",
"deleteConfirmText": "\"{{entryType}}\" appreciation entry will be permanently deleted."
},
+ "profile": {
+ "loading": "Loading profile...",
+ "notSetUp": "Your organisation profile is not set up yet — please complete registration."
+ },
"agentProfile": {
"agentProfile": "NGO Profile",
"registeredSince": "Registered since",
diff --git a/src/app/[lang]/dashboard/profile/page.tsx b/src/app/[lang]/dashboard/profile/page.tsx
new file mode 100644
index 00000000..f6db2609
--- /dev/null
+++ b/src/app/[lang]/dashboard/profile/page.tsx
@@ -0,0 +1,29 @@
+"use client";
+import CenteredWrapper from "@/components/core/common/CenteredWrapper";
+import { AgentProfileController } from "@/components/Dashboard/Profile/AgentProfileController";
+import { Paragraph } from "@/components/styled/text";
+import { useGetCurrentAgent } from "@/hooks/useGetCurrentAgent";
+import { useTranslation } from "react-i18next";
+
+export default function DashboardProfilePage() {
+ const { t } = useTranslation();
+ const { agentId, isLoading } = useGetCurrentAgent();
+
+ if (isLoading) {
+ return (
+
+ {t("dashboard.profile.loading")}
+
+ );
+ }
+
+ if (!agentId) {
+ return (
+
+ {t("dashboard.profile.notSetUp")}
+
+ );
+ }
+
+ return ;
+}
diff --git a/src/hooks/useGetCurrentAgent.ts b/src/hooks/useGetCurrentAgent.ts
index 65eb7b94..a2221a53 100644
--- a/src/hooks/useGetCurrentAgent.ts
+++ b/src/hooks/useGetCurrentAgent.ts
@@ -1,19 +1,28 @@
-import { apiPathAgentMe, cacheTTL } from "@/config/constants";
+import { apiPathAgent, apiPathMe, cacheTTL } from "@/config/constants";
import { useGetQuery } from "@/hooks";
import { getCookie } from "@/utils/helpers";
-import { ApiAgentGet } from "need4deed-sdk";
+import { ApiAgentGet, ApiUserGet } from "need4deed-sdk";
-// Requires BE: GET /api/agent/me — returns the agent profile for the logged-in agent user.
export const useGetCurrentAgent = () => {
const isLoggedIn = getCookie("is_logged_in") === "true";
- const { data, isLoading } = useGetQuery({
- queryKey: ["agent", "me"],
- apiPath: apiPathAgentMe,
+ const { data: user, isLoading: userLoading } = useGetQuery({
+ queryKey: ["user"],
+ apiPath: apiPathMe,
staleTime: cacheTTL,
enabled: isLoggedIn,
addLang: false,
});
- return { agent: data, isLoading };
+ const agentId = user?.agentId;
+
+ const { data: agent, isLoading: agentLoading } = useGetQuery({
+ queryKey: ["agent", String(agentId)],
+ apiPath: `${apiPathAgent}/${agentId}`,
+ staleTime: cacheTTL,
+ enabled: !!agentId,
+ addLang: false,
+ });
+
+ return { agent, agentId, isLoading: userLoading || (!!agentId && agentLoading) };
};