webapp: Removed hardcoded info about views which require authentication

If the return value of a API request equals 401 then the user will be redirected to the login page.
Using this method it's possible to decided within the API if a authentication is needed or not.
This commit is contained in:
Thomas Basler
2022-11-22 20:37:01 +01:00
parent e60619b867
commit a06a8fec3d
15 changed files with 50 additions and 60 deletions

View File

@@ -129,7 +129,7 @@ export default defineComponent({
getNtpConfig() {
this.dataLoading = true;
fetch("/api/ntp/config", { headers: authHeader() })
.then((response) => handleResponse(response, this.$emitter))
.then((response) => handleResponse(response, this.$emitter, this.$router))
.then(
(data) => {
this.ntpConfigList = data;
@@ -144,7 +144,7 @@ export default defineComponent({
getCurrentTime() {
this.dataLoading = true;
fetch("/api/ntp/time", { headers: authHeader() })
.then((response) => handleResponse(response, this.$emitter))
.then((response) => handleResponse(response, this.$emitter, this.$router))
.then(
(data) => {
this.mcuTime = new Date(
@@ -172,7 +172,7 @@ export default defineComponent({
headers: authHeader(),
body: formData,
})
.then((response) => handleResponse(response, this.$emitter))
.then((response) => handleResponse(response, this.$emitter, this.$router))
.then(
(response) => {
this.alertMessage = response.message;
@@ -195,7 +195,7 @@ export default defineComponent({
headers: authHeader(),
body: formData,
})
.then((response) => handleResponse(response, this.$emitter))
.then((response) => handleResponse(response, this.$emitter, this.$router))
.then(
(response) => {
this.alertMessage = response.message;