fix(shop): use backend shop in navigation

This commit is contained in:
zetaloop
2026-04-25 15:04:56 +08:00
parent 9cff134cf2
commit b50464c854
2 changed files with 16 additions and 8 deletions
+2 -4
View File
@@ -15,12 +15,12 @@ import {
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { getCurrentUserForLogin, logout as logoutRequest, switchCurrentRole } from "@/lib/api"
import { toApiError } from "@/lib/errors"
import { useMyShop } from "@/lib/hooks/use-my-shop"
import { notifyInfo } from "@/lib/toast"
import type { UserRole } from "@/lib/types"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
import { useNotificationStore } from "@/store/notifications"
import { useShopStore } from "@/store/shops"
import {
Bell,
Gamepad2,
@@ -57,10 +57,8 @@ export function Header() {
logout: clearAuth,
user,
} = useAuthStore()
const ownerShop = useShopStore((state) =>
user ? state.shops.find((shop) => shop.owner.id === user.id) : undefined,
)
const canOpenDashboard = currentRole === "player" || currentRole === "owner"
const { shop: ownerShop } = useMyShop(isAuthenticated && currentRole === "owner")
const navLinks =
currentRole === "consumer"