feat: 重构环境配置与 API 处理逻辑
更新 .env.example,补充玩家端本地开发配置说明,并新增直连 Laravel 服务及局域网访问相关配置选项。 重构 middleware.ts:使用新的 API 请求路径构建方法,提升代码清晰度与可维护性。 移除 next.config.ts 中已弃用的 API_BASE_URL 配置,简化 API 请求处理流程。 调整 lottery-http 以适配新的 API 基础地址解析机制,提升代码维护性。 优化 CSP(内容安全策略)配置,精简连接来源白名单管理,进一步增强安全性。
This commit is contained in:
@@ -13,13 +13,13 @@ import {
|
||||
} from "@/types/api/errors";
|
||||
import { isApiEnvelope } from "@/types/api/envelope";
|
||||
import { useErrorStore } from "@/stores/error-store";
|
||||
import { LOTTERY_API_V1_BASE } from "@/api/paths";
|
||||
import { resolveLotteryApiV1Base } from "@/lib/lottery-api-base";
|
||||
|
||||
/**
|
||||
* **第一层**:`baseURL` 对齐 Laravel `api/v1`;各 `api/*.ts` 只写业务 path(如 `/currencies`)。
|
||||
*/
|
||||
export const lotteryHttp = axios.create({
|
||||
baseURL: LOTTERY_API_V1_BASE,
|
||||
baseURL: resolveLotteryApiV1Base(),
|
||||
timeout: 30_000,
|
||||
headers: { Accept: "application/json" },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user