Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
4d4e4199
Commit
4d4e4199
authored
Oct 11, 2018
by
δΏ‘ι«-King
Committed by
ιεΈ
Oct 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: request cache if pro site (#2519)
parent
189accea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
src/utils/request.js
src/utils/request.js
+7
-5
No files found.
src/utils/request.js
View file @
4d4e4199
...
@@ -60,15 +60,17 @@ const cachedSave = (response, hashcode) => {
...
@@ -60,15 +60,17 @@ const cachedSave = (response, hashcode) => {
* Requests a URL, returning a promise.
* Requests a URL, returning a promise.
*
*
* @param {string} url The URL we want to request
* @param {string} url The URL we want to request
* @param {object} [option
s
] The options we want to pass to "fetch"
* @param {object} [option] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
* @return {object} An object containing either "data" or "err"
*/
*/
export
default
function
request
(
export
default
function
request
(
url
,
url
,
options
=
{
option
,
expirys
:
isAntdPro
(),
}
)
{
)
{
const
options
=
{
expirys
:
isAntdPro
(),
...
option
,
};
/**
/**
* Produce fingerprints based on url and parameters
* Produce fingerprints based on url and parameters
* Maybe url has the same parameters
* Maybe url has the same parameters
...
@@ -104,7 +106,7 @@ export default function request(
...
@@ -104,7 +106,7 @@ export default function request(
}
}
}
}
const
expirys
=
options
.
expirys
||
60
;
const
expirys
=
options
.
expirys
&&
60
;
// options.expirys !== false, return the cache,
// options.expirys !== false, return the cache,
if
(
options
.
expirys
!==
false
)
{
if
(
options
.
expirys
!==
false
)
{
const
cached
=
sessionStorage
.
getItem
(
hashcode
);
const
cached
=
sessionStorage
.
getItem
(
hashcode
);
...
...
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