Skip to content

Commit

Permalink
fix: AppBar.vue handles maintenance and nextlaunch now
Browse files Browse the repository at this point in the history
  • Loading branch information
rowangamal committed Aug 20, 2024
1 parent 2016678 commit 4cfbdfe
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion client/src/layouts/default/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,18 @@
<script>
import { ref, onMounted } from "vue";
import userService from "@/services/userService";
import { useRoute } from "vue-router";
import { useRoute, useRouter } from "vue-router";
export default {
setup() {
const route = useRoute();
const router = useRouter();
const drawer = ref(false);
const username = ref("");
const isActive = ref(0);
const token = ref(localStorage.getItem("token"));
const nextlaunch = ref(localStorage.getItem("nextlaunch"));
const maintenance = ref(localStorage.getItem("maintenance"));
const notifications = ref([]);
const excludedRoutes = ref([
"/",
Expand Down Expand Up @@ -212,6 +215,23 @@ export default {
}
};
const checkNextLaunch = () => {
userService.nextlaunch();
userService.handleNextLaunch();
nextlaunch.value = localStorage.getItem("nextlaunch") == "true";
if (!nextlaunch.value) {
router.push({ name: "NextLaunch" });
}
};
const checkMaintenance = () => {
userService.maintenance();
maintenance.value = localStorage.getItem("maintenance") == "false";
if (!maintenance.value) {
router.push({ name: "Maintenance" });
}
};
const getNotifications = () => {
userService
.getNotifications()
Expand Down Expand Up @@ -242,6 +262,8 @@ export default {
}
onMounted(() => {
checkNextLaunch();
checkMaintenance();
if (route.redirectedFrom) checkTitle(route.redirectedFrom.name);
checkExcludedFromNavBar(route.path);
Expand Down

0 comments on commit 4cfbdfe

Please sign in to comment.