0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-06-16 18:01:22 +02:00
Doodle3D-API/src/api/sketch.js
2017-11-30 17:23:13 +01:00

28 lines
723 B
JavaScript

import { parseFetch } from '../utils.js';
export default class Sketch {
constructor(api) {
this.api = api;
}
getSketch(id) {
return fetch(`${this.api}sketch/?id=${id}`, { method: 'GET' }).then(parseFetch);
}
set(data = '') {
return fetch(`${this.api}sketch`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ data })
}).then(parseFetch);
}
status() {
return fetch(`${this.api}sketch/status`, { method: 'GET' }).then(parseFetch);
}
clear() {
return fetch(`${this.api}sketch/clear`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
}).then(parseFetch);
}
}