Skip to content

Commit

Permalink
fix: add warning pages for unimplemented pages
Browse files Browse the repository at this point in the history
  • Loading branch information
wajeht committed May 29, 2023
1 parent d89a136 commit 34d30dc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/apps/ui/pages/dashboard/DashboardError.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup>
import { computed } from 'vue';
import Backheader from '../../components/dashboard/headers/Backheader.vue';
const isDev = computed(() => import.meta.env.MODE === 'development');
</script>
<template>
<!-- header -->
<Backheader />
<div class="container px-3 animate__animated animate__fadeIn animate__faster">
<div class="my-3 d-flex flex-column gap-3">
<div class="card">
<div class="card-body">
<h4 class="card-title">Error</h4>
<p v-if="isDev" class="card-text">Not implemented yet!</p>
<p v-else class="card-text">Something went wrong!</p>
</div>
</div>
</div>
</div>
</template>
21 changes: 21 additions & 0 deletions src/apps/ui/router.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import DashboardSignup from './pages/dashboard/DashboardSignup.vue';
import Community from './pages/dashboard/Community.vue';
import DashboardNotFound from './pages/dashboard/DashboardNotFound.vue';
import DashboardUnauthorized from './pages/dashboard/DashboardUnauthorized.vue';
import DashboardError from './pages/dashboard/DashboardError.vue';
import Videos from './pages/dashboard/Videos.vue';
import VideoDetails from './components/dashboard/VideoDetails.vue';

Expand Down Expand Up @@ -517,6 +518,7 @@ const routes = [
meta: {
layout: 'SingleDashboardLayout',
requiredAuth: true,
warn: true,
},
},
{
Expand All @@ -543,6 +545,15 @@ const routes = [
requiredAuth: true,
},
},
{
path: '/dashboard/error',
name: 'DashboardError',
component: DashboardError,
meta: {
layout: 'DashboardLayout',
requiredAuth: true,
},
},
{
path: '/dashboard/unauthorized',
name: 'DashboardUnauthorized',
Expand Down Expand Up @@ -585,6 +596,16 @@ router.beforeEach(async (to, from, next) => {
const userStore = useUserStore();
const appStore = useAppStore();

// this is for un-implemented pages
// meta: {
// layout: 'SingleDashboardLayout',
// requiredAuth: true,
// warn: true,
// },
if (to.matched.some((page) => page.meta?.warn)) {
return next('/dashboard/error');
}

// TODO: refactor this code below!
// if we hit required routes
if (to.matched.some((record) => record.meta.requiredAuth)) {
Expand Down

0 comments on commit 34d30dc

Please sign in to comment.