otp/utils/config.js
2025-06-17 14:44:48 +08:00

41 lines
No EOL
1,019 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 统一配置中心
* 合并原 config.js 和 configManager.js 的功能
*/
// 基础配置
const baseConfig = {
// 生产环境配置
API_BASE_URL: 'https://otpm.zeroc.net',
// API端点配置 (统一使用微信登录端点)
API_ENDPOINTS: {
AUTH: {
LOGIN: '/auth/login', // 改回原登录端点
REFRESH: '/auth/refresh'
},
OTP: {
SAVE: '/otp/save',
RECOVER: '/otp/recover',
CLEAR_ALL: '/otp/clear_all'
}
}
};
// JWT配置
const JWT_CONFIG = {
storage: {
access: 'jwt_access_token', // 访问令牌的存储键
refresh: 'jwt_refresh_token' // 刷新令牌的存储键
},
refreshThreshold: 5 * 60 * 1000, // 令牌刷新阈值5分钟
headerKey: 'Authorization', // 请求头中的认证键名
tokenPrefix: 'Bearer ' // 令牌前缀
};
// 导出合并后的配置
module.exports = {
API_ENDPOINTS: baseConfig.API_ENDPOINTS,
JWT_CONFIG, // 导出JWT配置
API_BASE_URL: baseConfig.API_BASE_URL
};