fix(shop): use backend shop in navigation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user