mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-04 06:36:27 +08:00
Add try/cath for JSON.parse
This commit is contained in:
parent
9cb26a1cb9
commit
b4102f3cfd
1 changed files with 8 additions and 6 deletions
|
@ -104,7 +104,7 @@ var SmartAnnotation = (function() {
|
|||
}
|
||||
$.getJSON(filterType.dataUrl, params, function(data) {
|
||||
|
||||
localStorage.setItem('smart_annotation_state_per_team/' + data.team, JSON.stringify({
|
||||
localStorage.setItem('scinote-smart-annotation-state-per-team-' + data.team, JSON.stringify({
|
||||
tag: filterType.tag,
|
||||
repository: data.repository
|
||||
}));
|
||||
|
@ -171,12 +171,14 @@ var SmartAnnotation = (function() {
|
|||
if ($currentAtWho.find('.tab-pane.active').length == 0) {
|
||||
let filterType = DEFAULT_SEARCH_FILTER.tag;
|
||||
let teamId = $currentAtWho.find('.atwho-header-res').data('team-id');
|
||||
let remeberedState = localStorage.getItem('smart_annotation_state_per_team/' + teamId);
|
||||
let remeberedState = localStorage.getItem('scinote-smart-annotation-state-per-team-' + teamId);
|
||||
if (remeberedState) {
|
||||
remeberedState = JSON.parse(remeberedState);
|
||||
filterType = remeberedState.tag;
|
||||
$currentAtWho.find(`.repository-object[data-object-id=${remeberedState.repository}]`)
|
||||
.addClass('btn-primary');
|
||||
try {
|
||||
remeberedState = JSON.parse(remeberedState);
|
||||
filterType = remeberedState.tag;
|
||||
$currentAtWho.find(`.repository-object[data-object-id=${remeberedState.repository}]`)
|
||||
.addClass('btn-primary');
|
||||
} catch {}
|
||||
}
|
||||
$currentAtWho.find(`.${filterType}`).click();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue