mirror of
https://example.com
synced 2024-11-24 07:36:39 +09:00
Fix: Only allow admins to access admin views (#8361)
* fix(client): only allow admins to access /admin/* * fix(client): Also allow moderators to access admin panel
This commit is contained in:
parent
5448ed643e
commit
7f4551b769
1 changed files with 3 additions and 3 deletions
|
@ -3,7 +3,7 @@ import { createRouter, createWebHistory } from 'vue-router';
|
|||
import MkLoading from '@/pages/_loading_.vue';
|
||||
import MkError from '@/pages/_error_.vue';
|
||||
import MkTimeline from '@/pages/timeline.vue';
|
||||
import { $i } from './account';
|
||||
import { $i, iAmModerator } from './account';
|
||||
import { ui } from '@/config';
|
||||
|
||||
const page = (path: string, ui?: string) => defineAsyncComponent({
|
||||
|
@ -67,8 +67,8 @@ const defaultRoutes = [
|
|||
{ path: '/my/antennas/:antennaId', component: page('my-antennas/edit'), props: true },
|
||||
{ path: '/my/clips', component: page('my-clips/index') },
|
||||
{ path: '/scratchpad', component: page('scratchpad') },
|
||||
{ path: '/admin/:page(.*)?', component: page('admin/index'), props: route => ({ initialPage: route.params.page || null }) },
|
||||
{ path: '/admin', component: page('admin/index') },
|
||||
{ path: '/admin/:page(.*)?', component: iAmModerator ? page('admin/index') : page('not-found'), props: route => ({ initialPage: route.params.page || null }) },
|
||||
{ path: '/admin', component: iAmModerator ? page('admin/index') : page('not-found') },
|
||||
{ path: '/notes/:note', name: 'note', component: page('note'), props: route => ({ noteId: route.params.note }) },
|
||||
{ path: '/tags/:tag', component: page('tag'), props: route => ({ tag: route.params.tag }) },
|
||||
{ path: '/user-info/:user', component: page('user-info'), props: route => ({ userId: route.params.user }) },
|
||||
|
|
Loading…
Reference in a new issue