From 0d0da636fd9dbbd3d91c3d500e1da0c54c7824c9 Mon Sep 17 00:00:00 2001 From: fazli Date: Mon, 6 Jul 2026 12:48:36 +0000 Subject: [PATCH] fix(seller-team): call /api/seller/v1/ (not /api/seller/) for team endpoints my-stores, members list/invite/remove all mount under /api/seller/v1/ in the Django backend, so my-stores and every team-management fetch was 404'ing. That made useMyStores throw silently, useStoreOwnership fall back to role=null, and the setting page's `!ownerOnly || role === "owner"` filter drop every owner-only tile (edit-store, team, financial-dashboard, shipping-method, instagram-sync). Owners could log into their own store and see none of the owner-gated menu items. Co-Authored-By: Claude Opus 4.7 --- app/requestHandler/use-seller-hooks.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/requestHandler/use-seller-hooks.ts b/app/requestHandler/use-seller-hooks.ts index c0df4e7..9f534ca 100644 --- a/app/requestHandler/use-seller-hooks.ts +++ b/app/requestHandler/use-seller-hooks.ts @@ -42,7 +42,7 @@ export function useMyStores() { queryKey: ["myStores"], queryFn: async (): Promise => { if (!token) return []; - const res = await fetch(`${getApiBaseUrl()}/api/seller/my-stores/`, { + const res = await fetch(`${getApiBaseUrl()}/api/seller/v1/my-stores/`, { headers: { Authorization: `Bearer ${token}` }, }); // Throw on failure so a transient error stays an ERROR state (data kept, @@ -64,7 +64,7 @@ export function useStoreMembers(username?: string) { queryKey: ["storeMembers", username], queryFn: async (): Promise => { const res = await fetch( - `${getApiBaseUrl()}/api/seller/members/${username}/`, + `${getApiBaseUrl()}/api/seller/v1/members/${username}/`, { headers: { Authorization: `Bearer ${token}` } } ); if (!res.ok) throw new Error("failed to load members"); @@ -81,7 +81,7 @@ export function useInviteMember(username?: string) { return useMutation({ mutationFn: async (phone: string) => { const res = await fetch( - `${getApiBaseUrl()}/api/seller/members/${username}/`, + `${getApiBaseUrl()}/api/seller/v1/members/${username}/`, { method: "POST", headers: { @@ -109,7 +109,7 @@ export function useRemoveMember(username?: string) { return useMutation({ mutationFn: async (memberId: string) => { const res = await fetch( - `${getApiBaseUrl()}/api/seller/members/${username}/${memberId}/`, + `${getApiBaseUrl()}/api/seller/v1/members/${username}/${memberId}/`, { method: "DELETE", headers: { Authorization: `Bearer ${token}` } } ); if (!res.ok) throw new Error("خطا در حذف عضو");