fix check for string exist

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2020-05-16 21:26:10 +02:00 committed by mrdrogdrog
parent aeeb08ea5a
commit c5bc4c4dcd

View file

@ -41,7 +41,7 @@ export function loadHistoryFromLocalStore(): HistoryEntry[] {
// if localStorage["history"] is empty we check the old localStorage["notehistory"]
// and convert it to the new format
const oldHistoryJsonString = window.localStorage.getItem("notehistory")
const oldHistory = oldHistoryJsonString ? JSON.parse(JSON.parse(oldHistoryJsonString)) : [];
const oldHistory = !!oldHistoryJsonString ? JSON.parse(JSON.parse(oldHistoryJsonString)) : [];
return oldHistory.map((entry: OldHistoryEntry) => {
return {
id: entry.id,