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
36eeb6c1
Commit
36eeb6c1
authored
Aug 05, 2018
by
ιεΈ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localStorage -> sessionStorage
parent
cb3c382b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
56 deletions
+58
-56
.stylelintrc.json
.stylelintrc.json
+28
-0
src/pages/Account/Center/Center.js
src/pages/Account/Center/Center.js
+3
-3
src/utils/request.js
src/utils/request.js
+27
-25
stylelint.config.js
stylelint.config.js
+0
-28
No files found.
.stylelintrc.json
0 β 100644
View file @
36eeb6c1
{
"extends"
:
[
"stylelint-config-standard"
,
"stylelint-config-prettier"
],
"rules"
:
{
"selector-pseudo-class-no-unknown"
:
null
,
"shorthand-property-no-redundant-values"
:
null
,
"at-rule-empty-line-before"
:
null
,
"at-rule-name-space-after"
:
null
,
"comment-empty-line-before"
:
null
,
"declaration-bang-space-before"
:
null
,
"declaration-empty-line-before"
:
null
,
"function-comma-newline-after"
:
null
,
"function-name-case"
:
null
,
"function-parentheses-newline-inside"
:
null
,
"function-max-empty-lines"
:
null
,
"function-whitespace-after"
:
null
,
"number-leading-zero"
:
null
,
"number-no-trailing-zeros"
:
null
,
"rule-empty-line-before"
:
null
,
"selector-combinator-space-after"
:
null
,
"selector-descendant-combinator-no-non-space"
:
null
,
"selector-list-comma-newline-after"
:
null
,
"selector-pseudo-element-colon-notation"
:
null
,
"unit-no-unknown"
:
null
,
"no-descending-specificity"
:
null
,
"value-list-max-empty-lines"
:
null
,
"no-missing-end-of-source-newline"
:
null
}
}
src/pages/Account/Center/Center.js
View file @
36eeb6c1
...
...
@@ -148,9 +148,9 @@ export default class Center extends PureComponent {
<
Divider
dashed
/>
<
div
className
=
{
styles
.
tags
}
>
<
div
className
=
{
styles
.
tagsTitle
}
>
ζ ηΎ
<
/div
>
{
currentUser
.
tags
.
concat
(
newTags
)
.
map
(
item
=>
<
Tag
key
=
{
item
.
key
}
>
{
item
.
label
}
<
/Tag>
)
}
{
currentUser
.
tags
.
concat
(
newTags
).
map
(
item
=>
(
<
Tag
key
=
{
item
.
key
}
>
{
item
.
label
}
<
/Tag
>
)
)}
{
inputVisible
&&
(
<
Input
ref
=
{
this
.
saveInputRef
}
...
...
src/utils/request.js
View file @
36eeb6c1
...
...
@@ -19,7 +19,7 @@ const codeMessage = {
503
:
'
ζε‘δΈε―η¨οΌζε‘ε¨ζζΆθΏθ½½ζη»΄ζ€γ
'
,
504
:
'
η½ε ³θΆ ζΆγ
'
,
};
function
checkStatus
(
response
)
{
const
checkStatus
=
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
300
)
{
return
response
;
}
...
...
@@ -32,7 +32,26 @@ function checkStatus(response) {
error
.
name
=
response
.
status
;
error
.
response
=
response
;
throw
error
;
}
};
const
cachedSave
=
(
response
,
hashcode
)
=>
{
/**
* Clone a response data and store it in sessionStorage
* Does not support data other than json, Cache only json
*/
let
contentType
=
response
.
headers
.
get
(
'
Content-Type
'
);
if
(
contentType
&&
contentType
.
match
(
/application
\/
json/i
))
{
// All data is saved as text
response
.
clone
()
.
text
()
.
then
(
content
=>
{
sessionStorage
.
setItem
(
hashcode
,
content
);
sessionStorage
.
setItem
(
hashcode
+
'
:timestamp
'
,
Date
.
now
());
});
}
return
response
;
};
/**
* Requests a URL, returning a promise.
...
...
@@ -47,7 +66,7 @@ export default function request(url, options = {}) {
* Produce fingerprints based on url and parameters
* Maybe url has the same parameters
*/
const
fingerprint
=
url
+
options
.
body
?
JSON
.
stringify
(
options
.
body
)
:
''
;
const
fingerprint
=
url
+
(
options
.
body
?
JSON
.
stringify
(
options
.
body
)
:
''
)
;
const
hashcode
=
hash
.
sha256
()
.
update
(
fingerprint
)
...
...
@@ -77,8 +96,8 @@ export default function request(url, options = {}) {
};
}
}
let
cached
=
local
Storage
.
getItem
(
hashcode
);
let
whenCached
=
local
Storage
.
getItem
(
hashcode
+
'
:timestamp
'
);
let
cached
=
session
Storage
.
getItem
(
hashcode
);
let
whenCached
=
session
Storage
.
getItem
(
hashcode
+
'
:timestamp
'
);
const
expirys
=
options
.
expirys
||
60
;
if
(
cached
!==
null
&&
whenCached
!==
null
&&
expirys
!==
false
)
{
let
age
=
(
Date
.
now
()
-
whenCached
)
/
1000
;
...
...
@@ -86,30 +105,13 @@ export default function request(url, options = {}) {
let
response
=
new
Response
(
new
Blob
([
cached
]));
return
response
.
json
();
}
else
{
local
Storage
.
removeItem
(
hashcode
);
local
Storage
.
removeItem
(
hashcode
+
'
:timestamp
'
);
session
Storage
.
removeItem
(
hashcode
);
session
Storage
.
removeItem
(
hashcode
+
'
:timestamp
'
);
}
}
return
fetch
(
url
,
newOptions
)
.
then
(
checkStatus
)
.
then
(
response
=>
{
/**
* Clone a response data and store it in localStorage
* Does not support data other than json, Cache only json
*/
let
contentType
=
response
.
headers
.
get
(
'
Content-Type
'
);
if
(
contentType
&&
contentType
.
match
(
/application
\/
json/i
))
{
// All data is saved as text
response
.
clone
()
.
text
()
.
then
(
content
=>
{
localStorage
.
setItem
(
hashcode
,
content
);
localStorage
.
setItem
(
hashcode
+
'
:timestamp
'
,
Date
.
now
());
});
}
return
response
;
})
.
then
(
cachedSave
)
.
then
(
response
=>
{
// DELETE and 204 do not return data by default
// using .json will report an error.
...
...
stylelint.config.js
deleted
100644 β 0
View file @
cb3c382b
export
default
{
extends
:
[
'
stylelint-config-standard
'
,
'
stylelint-config-prettier
'
],
rules
:
{
'
selector-pseudo-class-no-unknown
'
:
null
,
'
shorthand-property-no-redundant-values
'
:
null
,
'
at-rule-empty-line-before
'
:
null
,
'
at-rule-name-space-after
'
:
null
,
'
comment-empty-line-before
'
:
null
,
'
declaration-bang-space-before
'
:
null
,
'
declaration-empty-line-before
'
:
null
,
'
function-comma-newline-after
'
:
null
,
'
function-name-case
'
:
null
,
'
function-parentheses-newline-inside
'
:
null
,
'
function-max-empty-lines
'
:
null
,
'
function-whitespace-after
'
:
null
,
'
number-leading-zero
'
:
null
,
'
number-no-trailing-zeros
'
:
null
,
'
rule-empty-line-before
'
:
null
,
'
selector-combinator-space-after
'
:
null
,
'
selector-descendant-combinator-no-non-space
'
:
null
,
'
selector-list-comma-newline-after
'
:
null
,
'
selector-pseudo-element-colon-notation
'
:
null
,
'
unit-no-unknown
'
:
null
,
'
no-descending-specificity
'
:
null
,
'
value-list-max-empty-lines
'
:
null
,
'
no-missing-end-of-source-newline
'
:
null
,
},
};
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