uptime-kuma/src/pages/Entry.vue

47 lines
1.1 KiB
Vue
Raw Normal View History

2021-09-23 05:57:24 +00:00
<template>
<div>
2022-04-09 16:25:27 +00:00
<StatusPage v-if="statusPageSlug" :override-slug="statusPageSlug" />
</div>
2021-09-23 05:57:24 +00:00
</template>
<script>
import axios from "axios";
2022-04-06 14:43:22 +00:00
import StatusPage from "./StatusPage.vue";
2021-09-23 05:57:24 +00:00
export default {
2022-04-06 14:43:22 +00:00
components: {
StatusPage,
},
data() {
return {
statusPageSlug: null,
};
},
2021-09-23 05:57:24 +00:00
async mounted() {
2022-04-06 14:43:22 +00:00
// There are only 2 cases that could come in here.
// 1. Matched status Page domain name
// 2. Vue Frontend Dev
let res = (await axios.get("/api/entry-page")).data;
if (res.type === "statusPageMatchedDomain") {
this.statusPageSlug = res.statusPageSlug;
this.$root.forceStatusPageTheme = true;
2022-04-06 14:43:22 +00:00
2022-04-09 16:25:27 +00:00
} else if (res.type === "entryPage") { // Dev only. For production, the logic is in the server side
2022-04-06 14:43:22 +00:00
const entryPage = res.entryPage;
if (entryPage === "statusPage") {
this.$router.push("/status");
} else {
this.$router.push("/dashboard");
}
2021-09-23 05:57:24 +00:00
} else {
this.$router.push("/dashboard");
}
2022-04-06 14:43:22 +00:00
2021-09-23 05:57:24 +00:00
},
};
</script>