refactor(errors): migrate decisions to {code,msg}
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { allow, deny } from "@/lib/policy/assert"
|
||||
import { allow, deny } from "@/lib/decision"
|
||||
import type { Notification } from "@/lib/types"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
import { useNotificationStore } from "@/store/notifications"
|
||||
@@ -21,7 +21,7 @@ export function addNotification(input: {
|
||||
link?: string
|
||||
}) {
|
||||
if (!isNotificationEnabled(input.type)) {
|
||||
return deny("IDEMPOTENT_NOOP", "该类通知已关闭")
|
||||
return deny(400, "该类通知已关闭")
|
||||
}
|
||||
|
||||
useNotificationStore.getState().addNotification(input)
|
||||
|
||||
Reference in New Issue
Block a user