summaryrefslogtreecommitdiff
path: root/www/lib
diff options
context:
space:
mode:
authorngharo <nick@ngha.ro>2018-01-03 19:47:41 -0600
committerngharo <nick@ngha.ro>2018-01-03 19:47:41 -0600
commit1f4160511f4853de614355f45b94152fbd19e29e (patch)
tree77e144270ae0ecf8cebe8857246bb75ae6092013 /www/lib
parentf920c7da0618fd9f4181c2c78ef054e324185355 (diff)
downloadimOk-www-1f4160511f4853de614355f45b94152fbd19e29e.tar.xz
imOk-www-1f4160511f4853de614355f45b94152fbd19e29e.zip
-~-~ Under Construction ~-~-~~~~~HEADmaster
Diffstat (limited to 'www/lib')
-rw-r--r--www/lib/app.js64
1 files changed, 0 insertions, 64 deletions
diff --git a/www/lib/app.js b/www/lib/app.js
deleted file mode 100644
index 2ec1af2..0000000
--- a/www/lib/app.js
+++ /dev/null
@@ -1,64 +0,0 @@
-function create() {
- this.ready = false;
- fetch('/v1/button', {method: 'POST'}).then(response => {
- if (response.ok) {
- response.json().then(button => {
- this.buttons.push(button);
- this.ready = true;
- });
- }
- });
-}
-
-function update(index) {
- var button = this.buttons[index];
-
- this.ready = false;
- var payload = new FormData();
- payload.append('id', button.id);
- payload.append('status', button.status);
-
- fetch('/v1/button/', {
- method: 'PUT',
- body: payload
- }).then(response => {
- this.ready = true;
- })
-};
-
-function remove(index) {
- var button = this.buttons[index];
-
- this.ready = false;
- fetch('/v1/button/' + button.id, {method: 'DELETE'}).then(response => {
- if (response.ok) {
- response.json().then(ok => {
- this.buttons.splice(index, 1);
- this.ready = true;
- });
- }
- });
-}
-
-const $app = new Vue({
- el: '#container',
- data: {
- ready: false,
- buttons: []
- },
- methods: {
- create,
- remove,
- update
- }
-});
-
-// GET /button
-fetch('/v1/button').then(response => {
- if (response.ok) {
- response.json().then(buttons => {
- $app.buttons = buttons;
- $app.ready = true;
- })
- }
-});