-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import TokenService from "~/scripts/TokenService"; | ||
|
||
export default defineNuxtRouteMiddleware((to, from) => { | ||
const tokenService = new TokenService(); | ||
|
||
console.log("here"); | ||
switch (to.path) { | ||
case "/test": | ||
if (!tokenService.isLoggedIn()) { | ||
return navigateTo("/403"); | ||
} | ||
break; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<v-container class="d-flex justify-center align-center"> | ||
<v-row> | ||
<v-col cols="12" class="text-center"> | ||
<v-icon large class="mb-4">mdi-alert-circle-outline</v-icon> | ||
<h2 class="display-2">403 | Forbidden</h2> | ||
<p class="subtitle-1">You do not have permission to access this page.</p> | ||
<v-btn color="primary" @click="goHome">Go Home</v-btn> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
</template> | ||
|
||
<script setup> | ||
import { useRouter } from 'vue-router'; | ||
const router = useRouter(); | ||
const goHome = () => { | ||
router.push('/'); | ||
}; | ||
</script> | ||
|