Added error handling to CacheStart and implemented qr scanner as own page

This commit is contained in:
Katharina Will 2019-04-23 21:02:02 +02:00
parent 75798eaaca
commit 6f6fa8a0b0
5 changed files with 34 additions and 8 deletions

View File

@ -43,6 +43,19 @@
<q-item-label>Startseite</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
class="text-primary"
v-ripple
tag="a"
to="/qr-scanner"
>
<q-item-section avatar>
<q-icon name="camera"/>
</q-item-section>
<q-item-section>
<q-item-label>QR-Code Scanner</q-item-label>
</q-item-section>
<q-item
clickable
class="text-primary"

View File

@ -31,7 +31,7 @@
},
computed: {
isLoggedIn() {
return this.$store.getters['auth/GET_ADMINSTATE']; //TODO Methode umschreiben
return localStorage.getItem('userToken'); //TODO Methode umschreiben --> funktioniert das?
}
},
methods: {

View File

@ -52,8 +52,24 @@
console.log("Anfrage erfolgreich");
}) .catch((error) => {
console.log(error);
console.log("Anfrage fehlgeschlagen");
let msg;
let title;
if (error.response) {
// The request was made and the server responded with a status code
title = "Seite konnte nicht gefunden werden!";
msg = error.response;
} else if (error.request) {
// The request was made but no response was received
title = "Problem with request!";
msg = "Error occured due to wrong server request!"
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
title = "Error";
msg = error.message;
console.log('Error', error.message);
}
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { title: title, message: msg})
})
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`})
},

View File

@ -23,9 +23,6 @@
</qrcode-drop-zone>
</div>
<qrcode-capture v-if="noStreamApiSupport" @decode="onDecode"/>
<p class="decode-result">Last result: <b>{{ result }}</b></p>
<p class="validating">Validating: <b>{{ validating }}</b></p>
<p class="validating">is Valid: <b>{{ isValid }}</b></p>
</div>
</template>

View File

@ -16,9 +16,9 @@ const routes = [
children: [{ path: "", component: () => import("pages/Cache.vue") }]
},
{
path: "/qr-code-test/",
path: "/qr-scanner/",
component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/qr-code-test.vue") }]
children: [{ path: "", component: () => import("pages/qr-scanner.vue") }]
},
{
path: "/cache/:id",