Refactor navigation and add news functionality with WordPress integration

This commit is contained in:
ElPoyo
2026-02-11 10:15:36 +01:00
parent 4e11fd9a06
commit b7f55e0707
7 changed files with 721 additions and 27 deletions

View File

@@ -2,6 +2,8 @@
import Home from '../views/Home.vue'
import Texts from '../views/Texts.vue'
import TextReader from '../views/TextReader.vue'
import News from '../views/News.vue'
import NewsArticle from '../views/NewsArticle.vue'
import { textService } from '../services/textService.js'
const routes = [
@@ -22,17 +24,15 @@ const routes = [
props: true
},
{
path: '/au-hasard',
name: 'Random',
beforeEnter: async (to, from, next) => {
try {
const randomText = await textService.getRandomText()
next(`/texte/${randomText.id}`)
} catch (error) {
console.error('Erreur lors de la redirection vers un texte aléatoire:', error)
next('/textes')
}
}
path: '/actualites',
name: 'News',
component: News
},
{
path: '/actualite/:id',
name: 'NewsArticle',
component: NewsArticle,
props: true
}
]