0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-07-03 15:41:21 +02:00
Doodle3D-API/src/configapi.js
2015-07-15 15:06:18 +02:00

38 lines
677 B
JavaScript

import rest from 'src/restapi';
export default class {
constructor (localIP) {
this.localIP = localIP;
this.api = 'http://' + localIP + '/d3dapi/';
}
get (keys, callback) {
rest.get(this.api + 'config/?' + keys.join('=&') + '=', callback);
return this;
}
getAll (callback) {
rest.get(this.api + 'config/all', callback);
return this;
}
set (data, callback) {
var scope = this;
rest.post(this.api + 'config', data, function (response) {
/*for (var i in response.validation) {
if (response.validation[i] === 'ok') {
scope[i] = data[i];
}
}*/
if (callback !== undefined) {
callback(response);
}
});
return this;
}
}