29
29
<td :namespaces-test =" item.namespaces" >
30
30
{{ item.namespaces }}
31
31
</td >
32
- <td v-if = " item.confirmed " class =" pl-0" >
33
- <v-chip class = " ma-2 " color = " success " variant = " text " prepend-icon = " mdi-checkbox-marked-circle " >
34
- Confirmed
35
- </ v-chip >
36
- </ td >
37
- < td v-else class = " pl-0 " >
38
- < v-chip class = " ma-2 " color = " warning " variant = " text " prepend-icon = " mdi-alert-circle " >
39
- Not confirmed
32
+ <td class =" pl-0" >
33
+ <v-chip
34
+ class = " ma-2 "
35
+ :color = " statusChip[item.status].color "
36
+ variant = " text "
37
+ :prepend-icon = " statusChip[item.status].icon "
38
+ >
39
+ {{ statusChip[item.status].label }}
40
40
</v-chip >
41
41
</td >
42
42
91
91
import { computed , onMounted , ref , watch } from " vue" ;
92
92
import { useRouter } from " vue-router" ;
93
93
import useUsersStore from " @admin/store/modules/users" ;
94
- import { UserAdminResponse } from " @admin/api/client/api " ;
94
+ import { IUser } from " @admin/interfaces/IUser " ;
95
95
import useAuthStore from " @admin/store/modules/auth" ;
96
96
import useSnackbar from " @/helpers/snackbar" ;
97
97
import DataTable from " ../DataTable.vue" ;
98
98
import UserFormDialog from " ./UserFormDialog.vue" ;
99
99
import UserDelete from " ./UserDelete.vue" ;
100
100
import UserResetPassword from " ./UserResetPassword.vue" ;
101
101
102
- export interface IUser {
103
- id: string ;
104
- auth_methods: Array <string >;
105
- namespaces: number ;
106
- confirmed: boolean ;
107
- created_at: string ;
108
- last_login: string ;
109
- name: string ;
110
- email: string ;
111
- username: string ;
112
- password: string ;
113
- }
114
-
115
102
const router = useRouter ();
116
103
const snackbar = useSnackbar ();
117
104
const userStore = useUsersStore ();
@@ -123,6 +110,11 @@ const page = ref(1);
123
110
const filter = ref (" " );
124
111
const users = computed (() => userStore .getUsers as unknown as IUser []);
125
112
const totalUsers = computed (() => userStore .numberUsers );
113
+ const statusChip: Record <IUser [" status" ], { color: string ; icon: string ; label: string }> = {
114
+ confirmed: { color: " success" , icon: " mdi-checkbox-marked-circle" , label: " Confirmed" },
115
+ invited: { color: " warning" , icon: " mdi-email-alert" , label: " Invited" },
116
+ " not-confirmed" : { color: " error" , icon: " mdi-alert-circle" , label: " Not Confirmed" },
117
+ };
126
118
127
119
const header = [
128
120
{
@@ -220,7 +212,7 @@ const refreshUsers = async () => {
220
212
await userStore .refresh ();
221
213
};
222
214
223
- const redirectToUser = async (user : UserAdminResponse ) => {
215
+ const redirectToUser = async (user : IUser ) => {
224
216
router .push ({ name: " userDetails" , params: { id: user .id } });
225
217
};
226
218
0 commit comments