chore: 整合部署文件与管理端源码入仓
- deploy/server.Dockerfile、deploy/client-h5.Dockerfile(自 ai-art 仓库迁出,去重) - docker-compose.yml 迁入并修正路径(admin 上下文 ./admin),新增可选 h5 服务(profile 隔离) - admin/:管理前端完整源码(Vite+Vue3,自 workspace/dimension-admin 合并)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const TOKEN_KEY = 'dim_admin_token'
|
||||
export function getToken() { return localStorage.getItem(TOKEN_KEY) || '' }
|
||||
export function setToken(t) { localStorage.setItem(TOKEN_KEY, t) }
|
||||
export function clearToken() { localStorage.removeItem(TOKEN_KEY) }
|
||||
|
||||
export function apiGet(path) {
|
||||
return fetch(path, { headers: { Authorization: `Bearer ${getToken()}` } })
|
||||
.then(r => r.json())
|
||||
.then(j => j.data !== undefined ? j.data : j)
|
||||
.catch(e => { throw new Error(e.message) })
|
||||
}
|
||||
|
||||
export function apiPost(path, body) {
|
||||
return fetch(path, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` },
|
||||
body: JSON.stringify(body)
|
||||
}).then(r => r.json())
|
||||
}
|
||||
|
||||
export function apiPut(path, body) {
|
||||
return fetch(path, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` },
|
||||
body: JSON.stringify(body)
|
||||
}).then(r => r.json())
|
||||
}
|
||||
|
||||
export function apiDelete(path) {
|
||||
return fetch(path, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${getToken()}` }
|
||||
}).then(r => r.json())
|
||||
}
|
||||
Reference in New Issue
Block a user