Commit 6caa5ab4 authored by Aurélien Vermylen's avatar Aurélien Vermylen

Fix Gruntfile and stash before changing design of AutomaticAPIStorage

to one where objects are the 'vehicles' and all 'trips' are a new attachment.

Conflicts:
	Gruntfile.js
parent afd8fc42
...@@ -180,7 +180,9 @@ module.exports = function (grunt) { ...@@ -180,7 +180,9 @@ module.exports = function (grunt) {
'src/jio.storage/localstorage.js', 'src/jio.storage/localstorage.js',
'src/jio.storage/indexeddbstorage.js', 'src/jio.storage/indexeddbstorage.js',
'src/jio.storage/cryptstorage.js', 'src/jio.storage/cryptstorage.js',
'src/jio.storage/websqlstorage.js' 'src/jio.storage/websqlstorage.js',
'src/jio.storage/mappingstorage.js',
'src/jio.storage/fbstorage.js'
], ],
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js' dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
// dest: 'jio.js' // dest: 'jio.js'
......
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
'ended_at': data.results.ended_at || null, 'ended_at': data.results.ended_at || null,
'user': user_id}; 'user': user_id};
result.push(temp); result.push(temp);
jio._cache.put('/' + user_id + path, temp) jio._cache.put('/' + user_id + path, temp);
jio._cache.putAttachment('/', '', JSON.stringify(data.results)) jio._cache.putAttachment('/', '', JSON.stringify(data.results));
if (data._metadata.next === undefined) { if (data._metadata.next === undefined) {
return result; return result;
} }
...@@ -80,9 +80,11 @@ ...@@ -80,9 +80,11 @@
'xhrFields': {withCredentials: true} 'xhrFields': {withCredentials: true}
}).push(function (response) { }).push(function (response) {
if (response.target.status >= 400) { if (response.target.status >= 400) {
throw new jIO.util.jIOError(response.target.responseText ? throw new jIO.util.jIOError(
JSON.parse(response.target.responseText) : {}, response.target.responseText ?
response.target.status); JSON.parse(response.target.responseText) : {},
response.target.status
);
} }
return [JSON.parse(response.target.responseText), returned[1]]; return [JSON.parse(response.target.responseText), returned[1]];
}).push(treatNext); }).push(treatNext);
...@@ -146,14 +148,14 @@ ...@@ -146,14 +148,14 @@
if (!checkEndpointAsId(id)) { if (!checkEndpointAsId(id)) {
throw new jIO.util.jIOError('Invalid id.', 400); throw new jIO.util.jIOError('Invalid id.', 400);
} }
return jio._cache.get(id).push(function(res) { return this._cache.get(id).push(function (res) {
return res; return res;
}, function(error) { }, function () {
_queryAutomaticAPI(id, {}, this); _queryAutomaticAPI(id, {}, this);
}); });
}; };
AutomaticAPIStorage.prototype.put = function (id) { AutomaticAPIStorage.prototype.put = function () {
return; return;
}; };
...@@ -161,15 +163,15 @@ ...@@ -161,15 +163,15 @@
return; return;
}; };
AutomaticAPIStorage.prototype.remove = function (id) { AutomaticAPIStorage.prototype.remove = function () {
return; return;
}; };
AutomaticAPIStorage.prototype.putAttachment = function (id, name) { AutomaticAPIStorage.prototype.putAttachment = function () {
return; return;
}; };
AutomaticAPIStorage.prototype.removeAttachment = function (id, name) { AutomaticAPIStorage.prototype.removeAttachment = function () {
return; return;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment