Adding users controls on the frontend quit/shutdown/reboot

This commit is contained in:
Félix Aime
2021-01-11 13:42:29 +01:00
parent 2ea8ef49e8
commit 9ed61f201e
7 changed files with 186 additions and 12 deletions

View File

@@ -27,12 +27,11 @@
</div>
<div v-else>
<p>
<strong>Unfortunately, we got some issues.</strong>
<strong>Unfortunately, we got some issues <br />during the AP creation.</strong>
<br /><br />
Please verify that you've two Wifi interfaces on your device<br />
and restart it by clicking on the button below.<br />
Please verify that you've two WiFi interfaces on your device<br /> and try again by restarting it.<br /><br />
</p>
<button class="btn" v-on:click="reboot()">Reboot the device</button>
<button v-if="reboot_option" class="btn" v-on:click="reboot()">Restart the device</button>
</div>
</div>
@@ -53,14 +52,15 @@ export default {
capture_token: false,
capture_start: false,
interval: false,
error: false
error: false,
reboot_option: false
}
},
methods: {
generate_ap: function() {
clearInterval(this.interval)
this.ssid_name = false
axios.get(`/api/network/ap/start`, { timeout: 70000 })
axios.get(`/api/network/ap/start`, { timeout: 30000 })
.then(response => (this.show_ap(response.data)))
},
show_ap: function(data) {
@@ -109,9 +109,19 @@ export default {
}
});
}
}
},
load_config: function() {
axios.get(`/api/misc/config`, { timeout: 60000 })
.then(response => {
this.reboot_option = response.data.reboot_option
})
.catch(error => {
console.log(error)
});
},
},
created: function() {
this.load_config()
this.generate_ap();
}
}