refactor(errors): migrate decisions to {code,msg}

This commit is contained in:
zetaloop
2026-02-28 07:21:51 +08:00
parent 4e2ee5be54
commit cc24a0cbc3
23 changed files with 157 additions and 165 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
import type { Actor } from "@/lib/actor"
import { allow, deny } from "@/lib/decision"
import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop"
import type { Actor } from "@/lib/policy/actor"
import { allow, deny } from "@/lib/policy/assert"
import type { PolicyDecision } from "@/lib/policy/decision"
import type { ApiDecision } from "@/lib/errors"
import type { PlayerService } from "@/lib/types"
import { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders"
@@ -31,10 +31,10 @@ interface CreatePaidOrderInput {
note?: string
}
function resolveActorContext(): { actor?: Actor; decision: PolicyDecision } {
function resolveActorContext(): { actor?: Actor; decision: ApiDecision } {
const auth = useAuthStore.getState()
if (!auth.user?.id) {
return { decision: deny("AUTH_REQUIRED", "请先登录") }
return { decision: deny(401, "请先登录") }
}
const shopId =