Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mp_estate_client
Project
Project
Details
Activity
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
mp_estate_backstage
mp_estate_client
Commits
85f9cd4f
Commit
85f9cd4f
authored
Sep 02, 2020
by
成旭东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
dfc1f35d
Pipeline
#27829
failed with stage
in 45 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
package.json
package.json
+0
-5
config.ts
src/config.ts
+3
-2
request.ts
src/utils/request.ts
+3
-1
No files found.
package.json
View file @
85f9cd4f
...
...
@@ -32,11 +32,6 @@
"test:component"
:
"umi test ./src/components"
,
"tsc"
:
"tsc"
},
"husky"
:
{
"hooks"
:
{
"pre-commit"
:
"npm run lint-staged"
}
},
"lint-staged"
:
{
"**/*.less"
:
"stylelint --syntax less"
,
"**/*.{js,jsx,ts,tsx}"
:
"npm run lint-staged:js"
,
...
...
src/config.ts
View file @
85f9cd4f
let
DEFAULT_API_HOST
=
'https://uat-nginx.jianbing.com/cms_api'
;
const
{
host
}
=
window
.
location
;
let
DEFAULT_API_HOST
=
`https://
${
host
}
/api`
;
if
(
/^127
\.
0
\.
0
\.
1/
.
test
(
host
)
||
/^localhost/
.
test
(
host
)
||
/^192
\.
168
\.
/
.
test
(
host
))
{
DEFAULT_API_HOST
=
`http://
${
host
}
/cms_api`
;
}
...
...
src/utils/request.ts
View file @
85f9cd4f
...
...
@@ -59,10 +59,12 @@ const errorHandler = (error: { response: Response, data: object }): Response | o
/**
* 配置request请求时的默认参数
*/
const
{
host
}
=
window
.
location
;
const
request
=
extend
({
errorHandler
,
// 默认错误处理
credentials
:
'include'
,
// 默认请求是否带上cookie
prefix
:
'/cms_api'
,
prefix
:
host
.
indexOf
(
'com'
)
>
-
1
?
'/api'
:
'/cms_api'
,
});
// request拦截器, 改变url 或 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