fix
Docker Build and Push / build-image (push) Successful in 3m23s

This commit is contained in:
cheney
2026-08-04 09:33:52 +08:00
parent 3d84e8d8f7
commit 789505fb34
8 changed files with 147 additions and 39 deletions
+11 -1
View File
@@ -2,6 +2,12 @@
const TOKEN_KEY = 'iboard_token'
const REMEMBER_KEY = 'iboard_remember'
// API 基址:
// - 默认相对路径 `/api` (web dev: Vite 代理; web prod: 同源 Express 一起托管)
// - 打包 Android 时设 VITE_API_BASE=http://bh.vps.honor3.com:3001 走外网后端
const API_BASE = (import.meta.env.VITE_API_BASE || '').replace(/\/+$/, '')
const API_PREFIX = API_BASE ? API_BASE + '/api' : '/api'
export function getToken() {
return localStorage.getItem(TOKEN_KEY) || ''
}
@@ -20,9 +26,13 @@ export function setRememberFlag(v) {
else localStorage.removeItem(REMEMBER_KEY)
}
export function getApiBase() {
return API_BASE
}
export async function api(path, { method = 'GET', body, headers = {} } = {}) {
const token = getToken()
const res = await fetch('/api' + path, {
const res = await fetch(API_PREFIX + path, {
method,
headers: {
'Content-Type': 'application/json',