Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): navbar profile query not working (#10392)

Ubbeee44f3b4a9f4
diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/data.ts b/autogpt_platform/frontend/src/components/layout/Navbar/data.ts
index f7f79737dc..d89ec46e5a 100644
--- a/autogpt_platform/frontend/src/components/layout/Navbar/data.ts
+++ b/autogpt_platform/frontend/src/components/layout/Navbar/data.ts
@@ -1,8 +1,9 @@
-import { getV2GetUserProfile } from "@/app/api/__generated__/endpoints/store/store";
+import BackendAPI from "@/lib/autogpt-server-api";
import { getServerUser } from "@/lib/supabase/server/getServerUser";
export async function getNavbarAccountData() {
const { user } = await getServerUser();
+ const api = new BackendAPI();
const isLoggedIn = Boolean(user);
if (!isLoggedIn) {
@@ -15,8 +16,7 @@ export async function getNavbarAccountData() {
let profile = null;
try {
- const profileResponse = await getV2GetUserProfile();
- profile = profileResponse.data || null;
+ profile = await api.getStoreProfile();
} catch (error) {
console.error("Error fetching profile:", error);
profile = null;
diff --git a/autogpt_platform/frontend/src/tests/signin.spec.ts b/autogpt_platform/frontend/src/tests/signin.spec.ts
index 6b212f274d..60976cb488 100644
--- a/autogpt_platform/frontend/src/tests/signin.spec.ts
+++ b/autogpt_platform/frontend/src/tests/signin.spec.ts
@@ -6,9 +6,22 @@ test.describe("Authentication", () => {
await page.goto("/login");
await loginPage.login(testUser.email, testUser.password);
await test.expect(page).toHaveURL("/marketplace");
- await test
- .expect(page.getByTestId("profile-popout-menu-trigger"))
- .toBeVisible();
+
+ const accountMenuBtn = page.getByTestId("profile-popout-menu-trigger");
+
+ await test.expect(accountMenuBtn).toBeVisible();
+
+ await accountMenuBtn.click();
+
+ const dialog = page.getByRole("dialog");
+ await test.expect(dialog).toBeVisible();
+
+ const username = testUser.email.split("@")[0];
+ await test.expect(dialog.getByText(username)).toBeVisible();
+
+ const logoutBtn = page.getByRole("button", { name: "Log out" });
+ await test.expect(logoutBtn).toBeVisible();
+ await logoutBtn.click();
});
test("user can logout successfully", async ({