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 <noreply@anthropic.com>
This commit is contained in:
parent
ba8e839959
commit
0d0da636fd
@ -42,7 +42,7 @@ export function useMyStores() {
|
|||||||
queryKey: ["myStores"],
|
queryKey: ["myStores"],
|
||||||
queryFn: async (): Promise<MyStore[]> => {
|
queryFn: async (): Promise<MyStore[]> => {
|
||||||
if (!token) return [];
|
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}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
});
|
});
|
||||||
// Throw on failure so a transient error stays an ERROR state (data kept,
|
// 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],
|
queryKey: ["storeMembers", username],
|
||||||
queryFn: async (): Promise<StoreMember[]> => {
|
queryFn: async (): Promise<StoreMember[]> => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${getApiBaseUrl()}/api/seller/members/${username}/`,
|
`${getApiBaseUrl()}/api/seller/v1/members/${username}/`,
|
||||||
{ headers: { Authorization: `Bearer ${token}` } }
|
{ headers: { Authorization: `Bearer ${token}` } }
|
||||||
);
|
);
|
||||||
if (!res.ok) throw new Error("failed to load members");
|
if (!res.ok) throw new Error("failed to load members");
|
||||||
@ -81,7 +81,7 @@ export function useInviteMember(username?: string) {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (phone: string) => {
|
mutationFn: async (phone: string) => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${getApiBaseUrl()}/api/seller/members/${username}/`,
|
`${getApiBaseUrl()}/api/seller/v1/members/${username}/`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -109,7 +109,7 @@ export function useRemoveMember(username?: string) {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (memberId: string) => {
|
mutationFn: async (memberId: string) => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${getApiBaseUrl()}/api/seller/members/${username}/${memberId}/`,
|
`${getApiBaseUrl()}/api/seller/v1/members/${username}/${memberId}/`,
|
||||||
{ method: "DELETE", headers: { Authorization: `Bearer ${token}` } }
|
{ method: "DELETE", headers: { Authorization: `Bearer ${token}` } }
|
||||||
);
|
);
|
||||||
if (!res.ok) throw new Error("خطا در حذف عضو");
|
if (!res.ok) throw new Error("خطا در حذف عضو");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user