better handle 503 errors
This commit is contained in:
@@ -16,11 +16,18 @@
|
|||||||
<p v-else-if="pageError == 404">
|
<p v-else-if="pageError == 404">
|
||||||
The page you are looking for does not exist!
|
The page you are looking for does not exist!
|
||||||
</p>
|
</p>
|
||||||
|
<p v-else-if="pageError == 503">
|
||||||
|
The server is currently not responding and maybe under
|
||||||
|
maintenance. Please try again later!
|
||||||
|
</p>
|
||||||
<p v-else>
|
<p v-else>
|
||||||
We are working to fix that what was broken. Please try again
|
We are working to fix that what was broken. Please try again
|
||||||
later!
|
later!
|
||||||
</p>
|
</p>
|
||||||
<SMButton label="Go Back" @click="handleClick" />
|
<SMButton
|
||||||
|
v-if="pageError != 503"
|
||||||
|
label="Go Back"
|
||||||
|
@click="handleClick" />
|
||||||
</div>
|
</div>
|
||||||
</SMContainer>
|
</SMContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useUserStore } from "../store/UserStore";
|
import { useUserStore } from "../store/UserStore";
|
||||||
|
import { useApplicationStore } from "../store/ApplicationStore";
|
||||||
import { ImportMetaExtras } from "../../../import-meta";
|
import { ImportMetaExtras } from "../../../import-meta";
|
||||||
|
|
||||||
interface ApiProgressData {
|
interface ApiProgressData {
|
||||||
@@ -155,6 +156,7 @@ export const api = {
|
|||||||
if (xhr.status < 300) {
|
if (xhr.status < 300) {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
} else {
|
} else {
|
||||||
|
useApplicationStore().unavailable = true;
|
||||||
reject(result);
|
reject(result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -211,6 +213,7 @@ export const api = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (response.status >= 300) {
|
if (response.status >= 300) {
|
||||||
|
useApplicationStore().unavailable = true;
|
||||||
reject(result);
|
reject(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { defineStore } from "pinia";
|
|||||||
type ApplicationStoreEventKeyUpCallback = (event: KeyboardEvent) => boolean;
|
type ApplicationStoreEventKeyUpCallback = (event: KeyboardEvent) => boolean;
|
||||||
|
|
||||||
export interface ApplicationStore {
|
export interface ApplicationStore {
|
||||||
|
unavailable: boolean;
|
||||||
dynamicTitle: string;
|
dynamicTitle: string;
|
||||||
eventKeyUpStack: ApplicationStoreEventKeyUpCallback[];
|
eventKeyUpStack: ApplicationStoreEventKeyUpCallback[];
|
||||||
pageLoaderTimeout: number;
|
pageLoaderTimeout: number;
|
||||||
@@ -12,6 +13,7 @@ export interface ApplicationStore {
|
|||||||
export const useApplicationStore = defineStore({
|
export const useApplicationStore = defineStore({
|
||||||
id: "application",
|
id: "application",
|
||||||
state: (): ApplicationStore => ({
|
state: (): ApplicationStore => ({
|
||||||
|
unavailable: false,
|
||||||
dynamicTitle: "",
|
dynamicTitle: "",
|
||||||
eventKeyUpStack: [],
|
eventKeyUpStack: [],
|
||||||
pageLoaderTimeout: 0,
|
pageLoaderTimeout: 0,
|
||||||
|
|||||||
@@ -3,14 +3,17 @@
|
|||||||
<SMNavbar />
|
<SMNavbar />
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<router-view v-slot="{ Component }">
|
<SMPage v-if="useApplicationStore().unavailable" :page-error="503" />
|
||||||
<component :is="Component" />
|
<template v-else>
|
||||||
</router-view>
|
<router-view v-slot="{ Component }">
|
||||||
|
<component :is="Component" />
|
||||||
|
</router-view>
|
||||||
|
</template>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<SMPageFooter />
|
<SMPageFooter />
|
||||||
</footer>
|
</footer>
|
||||||
<div id="sm-page-loading">
|
<div v-if="!useApplicationStore().unavailable" id="sm-page-loading">
|
||||||
<SMLoadingIcon large />
|
<SMLoadingIcon large />
|
||||||
</div>
|
</div>
|
||||||
<SMToastList />
|
<SMToastList />
|
||||||
@@ -23,6 +26,7 @@ import SMPageFooter from "../components/SMPageFooter.vue";
|
|||||||
import SMToastList from "../components/SMToastList.vue";
|
import SMToastList from "../components/SMToastList.vue";
|
||||||
import SMDialogList from "../components/SMDialog";
|
import SMDialogList from "../components/SMDialog";
|
||||||
import SMLoadingIcon from "../components/SMLoadingIcon.vue";
|
import SMLoadingIcon from "../components/SMLoadingIcon.vue";
|
||||||
|
import { useApplicationStore } from "../store/ApplicationStore";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user