@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
68 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class ServerStorage {
constructor(url, token) {
this.url = url;
this.token = token;
}
async listProjects() {
const projects = await fetch(this.url, {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'list',
token: localStorage.getItem(this.token)
})
});
return projects.json();
}
async loadProject(id = 'app') {
const project = await fetch(this.url, {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'load',
token: localStorage.getItem(this.token),
id
})
});
return project.json();
}
async deleteProject(id) {
fetch(this.url, {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'delete',
token: localStorage.getItem(this.token),
id
})
});
}
saveProject(project) {
fetch(this.url, {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'save',
token: localStorage.getItem(this.token),
project: JSON.stringify(project)
})
});
return null;
}
}
exports.ServerStorage = ServerStorage;
//# sourceMappingURL=server_storage.js.map