Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
03f3f495
Commit
03f3f495
authored
Dec 10, 2024
by
qinjianhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: axios 修改
parent
3fac52d8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
src/api/axios.ts
+12
-4
No files found.
src/api/axios.ts
View file @
03f3f495
...
...
@@ -29,7 +29,8 @@ axios.interceptors.request.use(
Promise
.
reject
(
error
)
},
)
axios
.
interceptors
.
response
.
use
((
response
)
=>
{
axios
.
interceptors
.
response
.
use
(
(
response
)
=>
{
// 1. 判断响应码
const
data
=
response
.
data
...
...
@@ -39,18 +40,25 @@ axios.interceptors.response.use((response) => {
router
.
replace
({
path
:
'/user/login'
})
return
Promise
.
reject
(
data
)
}
if
(
data
.
code
!==
200
)
{
if
(
data
.
code
!==
200
)
{
showError
(
data
.
message
)
return
Promise
.
reject
(
data
)
}
}
return
data
})
},
(
error
)
=>
{
showError
(
error
.
message
)
return
Promise
.
reject
(
error
)
},
)
export
function
getFilePath
()
{
if
(
!
/
(
http|https
)
:
\/\/([^/]
+
)
/i
.
test
(
import
.
meta
.
env
.
BASE_URL
))
{
return
location
.
origin
+
import
.
meta
.
env
.
VITE_API_BASE_UPLOAD_URL
}
return
import
.
meta
.
env
.
VITE_API_BASE_URL
+
import
.
meta
.
env
.
VITE_API_BASE_UPLOAD_URL
return
(
import
.
meta
.
env
.
VITE_API_BASE_URL
+
import
.
meta
.
env
.
VITE_API_BASE_UPLOAD_URL
)
}
export
const
filePath
=
getFilePath
()
...
...
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