WIP device domain push
This commit is contained in:
parent
e6c2282fcf
commit
739f86f1cc
|
@ -51,9 +51,12 @@
|
|||
<ol>
|
||||
<li v-for="device in devices">
|
||||
<span v-if="device.id">{{ device.id }}</span> {{ device.socketId }}
|
||||
<ol>
|
||||
<ul>
|
||||
<li><form v-on:submit.stop.prevent="pushDomain(device)">
|
||||
<input type="text" v-model="device.newDomain" placeholder="ex: jon.telebit.com"></input><button type="submit">Push</button>
|
||||
</form></li>
|
||||
<li v-for="name in device.names">{{ name }}</li>
|
||||
</ol>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue