Skip to content

Commit

Permalink
fix: Fix possible type error when fetching user time entries
Browse files Browse the repository at this point in the history
  • Loading branch information
tcrammond authored and shantanuraj committed May 14, 2019
1 parent 25cc3a9 commit bcb8ca8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ window.TogglButton = {
localStorage.setItem('projects', JSON.stringify(projectMap));
localStorage.setItem('clients', JSON.stringify(clientMap));
TogglButton.$user = resp.data;
TogglButton.$user.time_entries = TogglButton.$user.time_entries.map((te) => {
// Ensure empty values from v8 become null.
return {
...te,
pid: te.pid || null,
tid: te.tid || null
};
});
TogglButton.$user.time_entries = (TogglButton.$user.time_entries || [])
.map((te) => {
// Ensure empty values from v8 become null.
return {
...te,
pid: te.pid || null,
tid: te.tid || null
};
});
TogglButton.$user.projectMap = projectMap;
TogglButton.$user.clientMap = clientMap;
TogglButton.$user.clientNameMap = clientNameMap;
Expand Down

0 comments on commit bcb8ca8

Please sign in to comment.