瀏覽代碼

Add some views and remove a useless bit

master
Jared 1 年之前
父節點
當前提交
5fdbf73391
共有 9 個文件被更改,包括 53 次插入41 次删除
  1. +8
    -8
      package-lock.json
  2. +1
    -0
      package.json
  3. +7
    -2
      src/App.vue
  4. +1
    -1
      src/lib/auth.ts
  5. +6
    -6
      src/router/index.ts
  6. +13
    -0
      src/views/ForbiddenView.vue
  7. +0
    -20
      src/views/LogoutView.vue
  8. +13
    -0
      src/views/NotFoundView.vue
  9. +4
    -4
      yarn.lock

+ 8
- 8
package-lock.json 查看文件

@@ -26,6 +26,7 @@
"@types/chai": "^4.2.15",
"@types/luxon": "^3.1.0",
"@types/mocha": "^8.2.1",
"@types/node": "^18.11.19",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
@@ -2485,11 +2486,10 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "18.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"dev": true,
"license": "MIT"
"version": "18.11.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
"integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==",
"dev": true
},
"node_modules/@types/normalize-package-data": {
"version": "2.4.1",
@@ -16514,9 +16514,9 @@
"dev": true
},
"@types/node": {
"version": "18.11.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz",
"integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==",
"version": "18.11.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
"integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==",
"dev": true
},
"@types/normalize-package-data": {


+ 1
- 0
package.json 查看文件

@@ -27,6 +27,7 @@
"@types/chai": "^4.2.15",
"@types/luxon": "^3.1.0",
"@types/mocha": "^8.2.1",
"@types/node": "^18.11.19",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",


+ 7
- 2
src/App.vue 查看文件

@@ -22,9 +22,9 @@
<RouterLink to="/admin/dashboard" class="button is-primary">
Admin
</RouterLink>
<RouterLink to="/logout" class="button is-white">
<button class="button is-white" @click="logout">
Log out
</RouterLink>
</button>
</div>
</div>
</div>
@@ -63,6 +63,7 @@ import {
} from 'vue';
import jwtDecode from 'jwt-decode';
import { Claims } from '@/api/types';
import { removeToken } from '@/lib/auth';

const userData = ref({
username: '',
@@ -113,6 +114,10 @@ const logoElements: LogoElement[] = [
letter: 't',
},
];

const logout = () => {
removeToken();
};
</script>

<style lang="stylus">


+ 1
- 1
src/lib/auth.ts 查看文件

@@ -3,7 +3,7 @@ import jwtDecode from 'jwt-decode';
import { Claims } from '@/api/types';
import * as luxon from 'luxon';

const removeToken = () => {
export const removeToken = () => {
sessionStorage.removeItem('jwt');
store.commit('clearToken');
};


+ 6
- 6
src/router/index.ts 查看文件

@@ -13,9 +13,9 @@ import AdminView from '@/views/AdminView.vue';
import ModifyQueueView from '@/views/ModifyQueueView.vue';
import AdminDashboardView from '@/views/AdminDashboardView.vue';
import ModifyUserView from '@/views/ModifyUserView.vue';
import LogoutView from '@/views/LogoutView.vue';
import ChangePasswordView from '@/views/ChangePasswordView.vue';
import store from '@/store';
import ForbiddenView from '@/views/ForbiddenView.vue';

const routes: Array<RouteRecordRaw> = [
{
@@ -42,11 +42,6 @@ const routes: Array<RouteRecordRaw> = [
component: ChangePasswordView,
meta: { title: 'Change Password' },
},
{
path: '/logout',
name: 'logout',
component: LogoutView,
},
{
path: '/admin',
name: 'admin',
@@ -122,6 +117,11 @@ const routes: Array<RouteRecordRaw> = [
title: 'Administrator',
},
},
{
path: '/forbidden',
name: 'forbidden',
component: ForbiddenView,
},
{
path: '/:pathMatch(.*)*',
name: 'wildcard',


+ 13
- 0
src/views/ForbiddenView.vue 查看文件

@@ -0,0 +1,13 @@
<template>
<section class="section is-medium">
<span class="is-size-3">403</span>
<p>Forbidden</p>
</section>
</template>

<script setup lang="ts">
</script>

<style scoped>

</style>

+ 0
- 20
src/views/LogoutView.vue 查看文件

@@ -1,20 +0,0 @@
<template>
<div>
Logging out...
</div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';
import store from '@/store';

store.commit('clearToken');
window.sessionStorage.removeItem('jwt');

const router = useRouter();
router.push('/');
</script>

<style scoped lang="stylus">

</style>

+ 13
- 0
src/views/NotFoundView.vue 查看文件

@@ -0,0 +1,13 @@
<template>

</template>

<script setup lang="ts">
export default {
name: "NotFoundView"
}
</script>

<style scoped>

</style>

+ 4
- 4
yarn.lock 查看文件

@@ -1270,10 +1270,10 @@
"resolved" "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz"
"version" "8.2.3"

"@types/node@*":
"integrity" "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg=="
"resolved" "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz"
"version" "18.11.9"
"@types/node@*", "@types/node@^18.11.19":
"integrity" "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw=="
"resolved" "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz"
"version" "18.11.19"

"@types/normalize-package-data@^2.4.0":
"integrity" "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw=="


Loading…
取消
儲存