1
1
<script setup lang="ts">
2
+ import axios from " axios" ;
2
3
import { mdiAccount } from ' @mdi/js' ;
3
-
4
+ axios .defaults .withCredentials = true ;
5
+ const {$gates, provide} = useNuxtApp ()
4
6
let drawer = ref (true );
5
- const imgUrl = new URL (' ../img/logo.png' , import .meta .url ).href
6
- const bgUrl = new URL (' ../img/bg.jpeg' , import .meta .url ).href
7
- const maleImg = new URL (' ../img/male.png' , import .meta .url ).href
7
+ const imgUrl = ' /img/logo.png'
8
+ const bgUrl = ' ../img/bg.jpeg'
9
+ const maleImg = ' /img/male.png'
10
+ const response = await axios .get (' http://localhost:8000/api/user' )
11
+ provide (' user' , response .data )
12
+ const $user = useNuxtApp ().$user
13
+ $gates .setRoles ($user .allRoles )
14
+ $gates .setPermissions ($user .allPermissions )
15
+ useHead ({
16
+ titleTemplate: ' %s - Boilerplate' ,
17
+ })
8
18
9
19
</script >
10
20
@@ -25,12 +35,12 @@ const maleImg = new URL('../img/male.png', import.meta.url).href
25
35
</template >
26
36
</v-list-item >
27
37
</v-toolbar >
28
- <v-card class =" rounded-0" variant =" text " :image =" bgUrl" height =" 150" >
38
+ <v-card class =" rounded-0" variant =" elevated " :image =" bgUrl" height =" 150" >
29
39
<v-list-item
30
40
class =" mt-10"
31
41
color =" black"
32
- title =" John Doe "
33
- subtitle =" Administrateur "
42
+ : title =" $user.name "
43
+ : subtitle =" $user.allRoles "
34
44
>
35
45
36
46
<template v-slot :prepend >
@@ -48,7 +58,7 @@ const maleImg = new URL('../img/male.png', import.meta.url).href
48
58
</v-navigation-drawer >
49
59
50
60
<v-app-bar elevation =" 3" app color =" primary" class =" rounded-be-xl" >
51
- <v-app-bar-nav-icon class =" bg-pink-lighten-1 " @click.stop =" drawer = !drawer" ></v-app-bar-nav-icon >
61
+ <v-app-bar-nav-icon class =" bg-indigo rounded-lg " @click.stop =" drawer = !drawer" ></v-app-bar-nav-icon >
52
62
53
63
<v-spacer ></v-spacer >
54
64
@@ -74,10 +84,10 @@ const maleImg = new URL('../img/male.png', import.meta.url).href
74
84
</v-col >
75
85
<v-col cols =" 12" >
76
86
<v-list-item >
77
- <v-list-item-title >Content filtering </v-list-item-title >
87
+ <v-list-item-title >{{ $user.name }} </v-list-item-title >
78
88
79
89
<v-list-item-subtitle >
80
- Administrateur
90
+ {{ $user.allRoles.join(', ') }}
81
91
</v-list-item-subtitle >
82
92
</v-list-item >
83
93
0 commit comments