diff options
| author | Ev Bogue <ev@evbogue.com> | 2019-04-04 09:57:51 -0500 | 
|---|---|---|
| committer | Ev Bogue <ev@evbogue.com> | 2019-04-04 09:57:51 -0500 | 
| commit | fd2a344391c940c41cb7065928e74e872dcd2e3c (patch) | |
| tree | a4976fe75120f90deb98f9f76889b8dacde4ad4d | |
| parent | 0b284168f623235f293fd43e03e50e1ba8f2dd86 (diff) | |
fix bug where log did not update when it did not exist
| -rw-r--r-- | app.js | 8 | 
1 files changed, 7 insertions, 1 deletions
| @@ -143,7 +143,13 @@ function route () {          // contact new items from the log onto the client's log of everything          var num = serverData.log.length - clientLog.log.length          var diff = serverData.log.slice(0, num) -        var oldLog = JSON.parse(localStorage['log']) + +        if (localStorage['log']) { +          var oldLog = JSON.parse(localStorage['log']) +        } else { +          var oldLog = [] +        } +          var newLog = diff.concat(oldLog)          localStorage['log'] = JSON.stringify(newLog) | 
