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
+14 -4
View File
@@ -12,11 +12,10 @@ import {
isDisputedOrder,
isPendingDispatch,
} from "@/lib/domain/order-filters"
import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop"
import { useMyShop } from "@/lib/hooks/use-my-shop"
import type { OrderStatus, UserRole } from "@/lib/types"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
import { useShopStore } from "@/store/shops"
import { Clock, MessageSquare, RefreshCw } from "lucide-react"
import Link from "next/link"
import { useEffect, useState } from "react"
@@ -65,8 +64,19 @@ function getOrderRole(role: UserRole): "consumer" | "player" | "owner" | undefin
export default function OrderListPage() {
const { currentRole, user } = useAuthStore()
const shops = useShopStore((state) => state.shops)
const ownerShop = resolveOwnerShop(user?.id, shops)
const {
shop: ownerShop,
loading: shopLoading,
error: shopError,
} = useMyShop(currentRole === "owner")
if (currentRole === "owner" && shopLoading) {
return <div className="text-sm text-muted-foreground">...</div>
}
if (currentRole === "owner" && shopError) {
return <div className="text-sm text-muted-foreground">{shopError}</div>
}
return (
<OrderListContent