feat: 积分商城-供应商

This commit is contained in:
2026-09-01 18:03:37 +08:00
parent 20d059443c
commit 750c36116d
39 changed files with 3692 additions and 9 deletions
+16
View File
@@ -0,0 +1,16 @@
const API_BASE = import.meta.env.VITE_SUPPLIED_ADMIN_API_BASE || 'http://127.0.0.1:8888/api/admin'
const normalizeBase = (base: string) => base.replace(/\/$/, '')
export const postAdmin = async <T>(name: string, body: Record<string, unknown>): Promise<T> => {
const response = await fetch(`${normalizeBase(API_BASE)}/${name}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
})
const payload = await response.json().catch(() => ({}))
if (!response.ok || payload.success === false) {
throw new Error(payload.error?.message || payload.msg || '请求失败')
}
return payload.data as T
}