Icônes + CSS et intégration Backend
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { inject } from 'vue'
|
||||
import type { VueCookies } from 'vue-cookies'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
@@ -9,6 +7,7 @@ const router = createRouter({
|
||||
path: '/',
|
||||
name: 'index',
|
||||
component: () => import('../views/IndexView.vue'),
|
||||
meta: { title: 'MainFrame' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -26,7 +25,7 @@ const router = createRouter({
|
||||
path: '/discord',
|
||||
name: 'discord',
|
||||
component: () => import('../views/DiscordView.vue'),
|
||||
meta: { discordAuth: true },
|
||||
meta: { title: 'MainFrame | Discord', discordAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -43,15 +42,9 @@ const router = createRouter({
|
||||
]
|
||||
})
|
||||
|
||||
router.beforeEach((to) => {
|
||||
const $cookies = inject<VueCookies>('$cookies')
|
||||
if (!$cookies) return console.log('Error: $cookies is not injected')
|
||||
|
||||
if (to.meta.discordAuth && !$cookies.isKey('DISCORD_CODE')) {
|
||||
window.location.href =
|
||||
'https://discord.com/oauth2/authorize?client_id=1274800564449841172&response_type=code&redirect_uri=https%3A%2F%2Fmainframe.zac.ovh%2Fdiscord&scope=identify'
|
||||
return
|
||||
}
|
||||
router.beforeEach((to, from, next) => {
|
||||
document.title = to.meta.title as string
|
||||
next()
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user