import { createRouter, createWebHistory } from 'vue-router'
import PageCatalogue from '@/views/PageCatalogue.vue'
import PageInscription from '@/views/PageInscription.vue'
import PageGestionCompte from '@/views/PageGestionCompte.vue'
import Profil from '@/components/GestionDeCompte/Profil.vue'
import HistoriqueCommande from '@/components/GestionDeCompte/HistoriqueCommande.vue'
// import MethodePaiement from '@/components/GestionDeCompte/MethodePaiement.vue'
import Adresse from '@/components/GestionDeCompte/Adresse.vue'
import Securite from '@/components/GestionDeCompte/Securite.vue'
import PageConnexion from '@/views/PageConnexion.vue'
import PageDetailsCarte from '@/views/PageDetailsCarte.vue'
import PagePolitiqueConfidentialite from '@/views/PagePolitiqueConfidentialite.vue'
import accueil from '@/views/accueil.vue'
import PageMotDePasseOublie from '@/views/PageMotDePasseOublie.
vue'
import PageNewPwdAfterForget from '@/views/PageNewPwdAfterForget.vue'
import PageAPropos from '@/views/PageAPropos.vue'
import PageResetCodeSent from '@/views/PageResetCodeSent.vue'
import PageresetCodeLoading from '@/views/PageresetCodeLoading.vue'
import PagePanier from '@/views/PagePanier.vue'
import PageGestionMagasin from '@/views/PageGestionMagasin.vue'
import Promotions from '@/components/GestionMagasin/Promotions.vue'
import PagePromotionCartes from '@/views/PagePromotionCartes.vue'
import Inventaire from '@/components/GestionMagasin/Inventaire.vue'
import DetailsCommande from '@/components/GestionMagasin/GestionCommandes/DetailsCommande.vue'
import Employes from '@/components/GestionMagasin/Employes.vue'
import ManageEmployee from '@/components/GestionMagasin/ManageEmployee.vue'
import AddEmployee from '@/components/GestionMagasin/AddEmployee.vue'
import { useAuthStore } from '@/stores/authStore'
import Clients from '@/components/GestionMagasin/Clients.vue'
import PaymentSuccess from '@/views/PaymentSuccess.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{ path: '/', name: 'default', component: accueil },
{
path: '/catalogue',
name: 'catalogue',
component: PageCatalogue,
},
{
path: '/panier',
name: 'MonPanier',
component: PagePanier,
},
{
path: '/inscription',
name: 'Inscription',
component: PageInscription,
},
{
path: '/gestionCompte',
name: 'Gestioncompte',
component: PageGestionCompte,
redirect: (to) => {
return { name: 'Profil' }
},
children: [
{
path: 'profil',
name: 'Profil',
component: Profil,
},
{
path: 'historiqueCommande',
name: 'HistoriqueCommande',
component: HistoriqueCommande,
},
{
path: 'adresse',
name: 'Adresse',
component: Adresse,
},
{
path: 'securite',
name: 'Securite',
component: Securite,
},
],
},
{
path: '/connexion',
name: 'connexion',
component: PageConnexion,
},
{
path: '/forgotPassword',
name: 'forgotpassword',
component: PageMotDePasseOublie,
},
{
path: '/resetCodeSent',
name: 'resetCodeSent',
component: PageResetCodeSent,
},
{
path: '/resetCodeLoading',
name: 'resetCodeLoading',
component: PageresetCodeLoading,
props: (route) => ({
email: route.query.email,
resetCode: route.query.resetCode,
}),
},
{ path: '/NewPassword', name: 'NewPassword', component: PageNewPwdAfterForget },
{
path: '/Cards/:id/',
name: 'DetailsCarte',
component: PageDetailsCarte,
},
{
path: '/promotion/:id/cartes',
name: 'PromotionCartes',
component: PagePromotionCartes,
},
{
path: '/APropos',
name: 'APropos',
component: PageAPropos,
},
{
path: '/PolitiqueConfidentialite',
name: 'PolitiqueConfidentialite',
component: PagePolitiqueConfidentialite,
},
{
path: '/details-commande/:orderId',
name: 'DetailsCommande',
component: DetailsCommande,
meta: { requiresAuth: true },
props: (route) => ({
orderId: route.params.orderId,
}),
},
{
path: '/gestionMagasin',
name: 'GestionMagasin',
component: PageGestionMagasin,
meta: { requiresAuth: true },
redirect: (to) => {
return { name: 'Inventaire' }
},
children: [
{
path: 'promotions',
name: 'Promotions',
component: Promotions,
},
{
path: 'inventaire',
name: 'Inventaire',
component: Inventaire,
},
{
path: 'employes',
name: 'Employes',
component: Employes,
},
{
path: 'manage-employee',
name: 'Manage-employee',
component: ManageEmployee,
props: (route) => ({
id: route.query.id,
}),
},
{
path: 'add-employee',
name: 'Add-employee',
component: AddEmployee,
},
{
path: 'clients',
name: 'Clients',
component: Clients,
},
],
},
{
path: '/PaymentSuccess',
name: 'PaymentSuccess',
component: PaymentSuccess,
},
],
})