Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-web
Commits
8941ed9e
Commit
8941ed9e
authored
Nov 22, 2017
by
Mattias J Duffy
Browse files
localstorage fails gracefully
parent
7f8a0cc9
Pipeline
#1771
passed with stage
in 1 minute and 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/containers/Layout.js
View file @
8941ed9e
...
...
@@ -21,13 +21,19 @@ class Layout extends React.Component {
than an API call). After retrieving from local storage, then call the API to see if there
are any updates.
*/
if
(
localStorage
.
getItem
(
'
facilities
'
))
{
const
facilities
=
localStorage
.
getItem
(
'
facilities
'
);
this
.
props
.
setFacilities
(
facilities
)
}
if
(
localStorage
.
getItem
(
'
favorites
'
))
{
const
favorites
=
JSON
.
parse
(
localStorage
.
getItem
(
'
favorites
'
));
this
.
props
.
setAllFavorites
(
favorites
);
try
{
localStorage
=
window
.
localStorage
;
if
(
localStorage
.
getItem
(
'
facilities
'
))
{
const
facilities
=
localStorage
.
getItem
(
'
facilities
'
);
this
.
props
.
setFacilities
(
facilities
)
}
if
(
localStorage
.
getItem
(
'
favorites
'
))
{
const
favorites
=
JSON
.
parse
(
localStorage
.
getItem
(
'
favorites
'
));
this
.
props
.
setAllFavorites
(
favorites
);
}
}
catch
(
e
)
{
console
.
log
(
'
you should enable cookies so we can remember what places you favorite
'
)
}
this
.
props
.
getFacilities
()
...
...
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