-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathconfig.js
More file actions
63 lines (53 loc) · 1.17 KB
/
config.js
File metadata and controls
63 lines (53 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* API配置文件
* 定义接口相关的配置信息和常量
*/
// 基础配置
export const API_CONFIG = {
// 基础URL配置
BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5707',
// 超时配置
TIMEOUT: 30000,
// 请求头配置
HEADERS: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}
// 接口路径常量
export const API_PATHS = {
// 模块数据接口
MODULE: '/api',
// 代理接口
PROXY: '/proxy',
// 解析接口
PARSE: '/parse'
}
// 模块功能类型
export const MODULE_ACTIONS = {
PLAY: 'play', // 播放接口
CATEGORY: 'category', // 分类接口
DETAIL: 'detail', // 详情接口
ACTION: 'action', // 动作接口
SEARCH: 'search', // 搜索接口
REFRESH: 'refresh', // 刷新接口
HOME: 'home' // 首页接口(默认)
}
// 响应状态码
export const RESPONSE_CODES = {
SUCCESS: 200,
NOT_FOUND: 404,
SERVER_ERROR: 500
}
// 默认分页配置
export const PAGINATION = {
DEFAULT_PAGE: 1,
DEFAULT_PAGE_SIZE: 20
}
export default {
API_CONFIG,
API_PATHS,
MODULE_ACTIONS,
RESPONSE_CODES,
PAGINATION
}