refactor(auth): centralize role checks into utility

Removed direct user role string checks and replaced with type-safe utils.
This commit is contained in:
2026-06-16 18:30:26 +02:00 Unverified
parent b75e7bbafd
commit 942143ddc7
7 changed files with 61 additions and 26 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ const banError = ref('')
const roleError = ref('')
const pendingBanUser = ref<any | null>(null)
const isUpdatingBan = ref(false)
const parseRoles = (roles?: string) => roles ? roles.split(',').map((r) => r.trim().toUpperCase()).filter(Boolean) : []
const parseRoles = (roles?: string) => roles ? roles.split(',').map(normalizeRole).filter(Boolean) : []
const banConfirmMessage = computed(() =>
pendingBanUser.value
? `Vuoi ${pendingBanUser.value.banned ? 'sbloccare' : 'bannare'} utente ${pendingBanUser.value.first_name} ${pendingBanUser.value.last_name}?`