Skip to content

Commit

Permalink
Added fallback to localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogball committed Dec 19, 2017
1 parent 24412f5 commit 57208a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions addon/helpers/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ function tryStorage(name) {
}

function getStorage(name) {
// Attempt to fall back to localStorage if the provided
// type is not supported, ignoring custom drivers
if (!localforage.supports(drivers[name]) && !customDrivers[name]) {
name = 'local';
}
if (storage[name]) {
return storage[name];
} else {
Expand Down
2 changes: 1 addition & 1 deletion addon/serializers/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default JSONAPISerializer.extend({
_shouldSerializeHasMany: function() { return true; },
shouldSerializeHasMany: function() { return true; },
// Ensure that returned data is null if undefined
normalizeResponse(store, modelClass, payload, id, requestType) {
normalizeResponse() {
const result = this._super(...arguments);
if (result.data === undefined) {
result.data = null;
Expand Down

0 comments on commit 57208a3

Please sign in to comment.