Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑磊
web-lib
Commits
162ff19e
Commit
162ff19e
authored
Mar 22, 2024
by
郑磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新默认的请求配置项
parent
8ede0788
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
create.ts
src/api/create.ts
+17
-9
No files found.
src/api/create.ts
View file @
162ff19e
...
...
@@ -66,18 +66,26 @@ const INTERNAL_OPTION_KEYS: (keyof ApiRequestDefaultOptions)[] = [
'signature_secret'
,
]
/**
* 默认的API请求配置
*/
export
const
DEFAULT_API_OPTIONS
=
{
source
:
'xinxiuweb'
,
app_version
:
'1.0.0'
,
device
:
'wap'
,
signature_secret
:
'asdasgfdwqew'
,
method
:
'POST'
,
}
/**
* 创建用于请求接口的Axios实例
*/
export
function
createAxiosInstance
(
options
:
CreateInstanceDefaults
=
{
source
:
'xinxiuweb'
,
app_version
:
'1.0.0'
,
device
:
'wap'
,
signature_secret
:
'asdasgfdwqew'
,
method
:
'POST'
,
},
):
ApiAxiosInstance
{
export
function
createAxiosInstance
(
options
:
CreateInstanceDefaults
=
{}):
ApiAxiosInstance
{
options
=
{
...
DEFAULT_API_OPTIONS
,
...
options
,
}
const
instance
=
axios
.
create
(
options
)
//按倒序注入请求拦截器,最后处理的最先注入
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment