From 739f86f1cc18d985f4f1db47cb732581cb927f12 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 20 Aug 2018 20:12:28 +0000 Subject: [PATCH] WIP device domain push --- lib/extensions/admin/account.html | 7 +++++-- lib/extensions/admin/js/account.js | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/extensions/admin/account.html b/lib/extensions/admin/account.html index 4792923..b9f8f14 100644 --- a/lib/extensions/admin/account.html +++ b/lib/extensions/admin/account.html @@ -51,9 +51,12 @@
  1. {{ device.id }} {{ device.socketId }} -
      +
        +
      • + +
      • {{ name }}
      • -
    +
diff --git a/lib/extensions/admin/js/account.js b/lib/extensions/admin/js/account.js index 85b1fe1..7ea8734 100644 --- a/lib/extensions/admin/js/account.js +++ b/lib/extensions/admin/js/account.js @@ -67,6 +67,24 @@ , challengeEmail: function () { console.log("A new (Email) challenger!", vueData); } + , pushDomain: function (dev) { + // TODO do some local validation too + console.log('pushDomain', dev); + vueData.spinner = true; + return oauth3.request({ + url: 'https://api.' + location.hostname + '/api/telebit.cloud/devices/:dev/:name' + .replace(/:dev/g, dev.socketId) + .replace(/:name/g, dev.newDomain) + , method: 'POST' + , session: session + }).catch(function (err) { + console.error(err); + window.alert(err.toString()); + }).then(function () { + dev.newDomain = ''; + vueData.spinner = false; + }); + } , login: function () { var email = vueData.newEmail; vueMethods.logout();