-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from abes-esr/ITEM-102-Migrer-la-page-d'accuei…
…l-en-vue-3 Item 102 migrer la page d'accueil en vue 3
- Loading branch information
Showing
14 changed files
with
894 additions
and
608 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<div | ||
class="btnAccueil py-12 px-4 d-flex align-center rounded" | ||
style=" border-radius: 20px;" | ||
@click="router.push(route)" | ||
> | ||
<v-icon x-large color="grey-darken-2" class="mr-3">{{ icon }}</v-icon> | ||
<h3 class="flex-grow-1 text-center"> | ||
<slot/> | ||
</h3> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import router from '@/router'; | ||
const props = defineProps({ | ||
icon: { type: String, required: true }, | ||
route: { type: String, required: true } | ||
}) | ||
</script> | ||
<style scoped> | ||
.btnAccueil:hover { | ||
cursor: pointer; | ||
background-color: lightgrey !important; | ||
transition-duration: 0.3s; | ||
} | ||
.btnAccueil { | ||
border: 1px solid black; | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { createRouter, createWebHistory } from 'vue-router'; | ||
import Main from '@/views/AppLogin.vue'; | ||
import ExempTable from '@/views/ExempTable.vue'; | ||
import ModifTable from '@/views/ModifTable.vue'; | ||
import RecouvTable from '@/views/RecouvTable.vue'; | ||
import ModifSteps from '@/views/ModifSteps.vue'; | ||
import Accueil from '@/views/Accueil.vue'; | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
component: Accueil, | ||
// meta: { requiresAuth: true } | ||
}, | ||
{ | ||
path: '/login', | ||
name: 'login', | ||
component: Main, | ||
meta: { requiresAuth: false } | ||
}, | ||
{ | ||
path: '/accueil', | ||
name: 'accueil', | ||
component: Accueil, | ||
meta: { requiresAuth: true } | ||
}, | ||
{ | ||
path: '/exemplarisationTableau', | ||
name: 'exemplarisationTableau', | ||
component: ExempTable, | ||
meta: { requiresAuth: true } | ||
}, | ||
{ | ||
path: '/modificationTableau', | ||
name: 'modificationTableau', | ||
component: ModifTable, | ||
meta: { requiresAuth: true } | ||
}, | ||
{ | ||
path: '/recouvrementTableau', | ||
name: 'recouvrementTableau', | ||
component: RecouvTable, | ||
meta: { requiresAuth: true } | ||
}, | ||
{ | ||
path: '/modificationNouvelleDemande', | ||
name: 'modificationNouvelleDemande', | ||
component: ModifSteps, | ||
meta: { requiresAuth: true } | ||
}, | ||
// Ajoutez d'autres routes selon vos besoins | ||
]; | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(), | ||
routes | ||
}); | ||
|
||
router.beforeEach(async (to, from, next) => { | ||
const requiresAuth = to.matched.some(record => record.meta.requiresAuth); | ||
|
||
if (requiresAuth) { | ||
const user = JSON.parse(sessionStorage.getItem('user')); | ||
// Vérifiez si l'utilisateur est authentifié | ||
const isAuthenticated = user && user.token; | ||
if (!isAuthenticated) { | ||
// L'utilisateur n'est pas authentifié, redirigez-le vers la page de connexion | ||
// next('/login'); | ||
} | ||
} | ||
// La page ne nécessite pas d'authentification, autorisez l'accès | ||
next(); | ||
}); | ||
|
||
export default router; |
Oops, something went wrong.