Skip to content

Commit

Permalink
adding to local storage
Browse files Browse the repository at this point in the history
relates to #163
  • Loading branch information
pbywater committed Aug 1, 2017
1 parent 38d9691 commit 7914e19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/d3/d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function render(updatedData) {
const heading = splitData[0].split('=')[1];
const text = splitData[1].split('=')[1];
const tag = splitData[2].split('=')[1];
// storePendingActions('textToAdd', { memories: [{ id, text }] }, { id, text });
storePendingActions('textToAdd', { memories: [{ id: 100, heading, text, tag }] }, { id: 100, heading, text, tag });
// const offlineData = removeMemoryFromStoredData(id);
// render(formatData(offlineData));
}
Expand Down
9 changes: 9 additions & 0 deletions src/client/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ function removeMemoryFromStoredData(id) {
return offlineData;
}

function addMemoryToStoredData(id) {
// const offlineData = JSON.parse(localStorage.getItem('data'));
// const toAdd =
// offlineData.push()
// const offlineDataAfterAdding = JSON.stringify(offlineData);
// localStorage.setItem('data', offlineDataAfterRemoving);
// return offlineData;
}

function clearPendingActions(storedName, index) {
const memoriesWaitingToBeRemoved = JSON.parse(localStorage.getItem(storedName));
if (memoriesWaitingToBeRemoved.memories.length === 1) {
Expand Down

0 comments on commit 7914e19

Please sign in to comment.