0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-06-02 13:54:31 +02:00
Doodle3D-API/src/api/sketch.js
casperlamboo 5a11fafb0c fix posts
2018-01-25 17:29:51 +01:00

25 lines
648 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 = '') {
const body = new URLSearchParams();
body.append('data', data);
return fetch(`${this.api}sketch`, { method: 'POST', body }).then(parseFetch);
}
status() {
return fetch(`${this.api}sketch/status`, { method: 'GET' }).then(parseFetch);
}
clear() {
const body = new URLSearchParams();
return fetch(`${this.api}sketch/clear`, { method: 'POST', body }).then(parseFetch);
}
}