refactor(errors): migrate decisions to {code,msg}
This commit is contained in:
+5
-5
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user