Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-dj-oss-equity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2c7e8462
authored
Jul 16, 2021
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
3bf269ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
44 deletions
src/api/axios.js
src/api/axios.js
deleted
100644 → 0
View file @
3bf269e
import
axios
from
'axios'
import
Qs
from
'qs'
axios
.
defaults
.
withCredentials
=
true
let
config
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'GLSX_OSS_EQUITY_CONFIG'
))
const
baseURL
=
config
.
axios
.
baseURL
const
service
=
axios
.
create
({
baseURL
:
baseURL
,
timeout
:
60
*
1000
,
// 请求超时时间
transformRequest
:
[
function
(
data
)
{
return
Qs
.
stringify
(
data
)
}],
})
service
.
interceptors
.
request
.
use
(
config
=>
{
return
config
}
)
service
.
interceptors
.
response
.
use
(
response
=>
{
const
dataAxios
=
response
.
data
// 这个状态码是和后端约定的
const
{
code
}
=
dataAxios
// 有 code 代表这是一个后端接口 可以进行进一步的判断
if
(
code
==
-
1
)
{
return
dataAxios
}
switch
(
+
code
)
{
case
0
:
return
dataAxios
case
20
:
case
21
:
break
default
:
break
}
},
error
=>
{
console
.
log
(
error
)
console
.
log
(
baseURL
)
return
Promise
.
reject
(
error
)
})
export
default
service
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment