feat: Improve role verification logic in InterestDuplicateNotificationBanner for duplicate checks
This commit is contained in:
parent
3f90db0392
commit
b6d71faf5f
|
|
@ -50,15 +50,16 @@ const checkForDuplicates = async () => {
|
|||
try {
|
||||
loading.value = true;
|
||||
|
||||
// Check roles with better error handling
|
||||
// Check roles with better error handling - use hasAnyRole for multiple roles
|
||||
const { hasAnyRole, isAdmin, isSalesOrAdmin } = useAuthorization();
|
||||
let canViewDuplicates = false;
|
||||
|
||||
try {
|
||||
canViewDuplicates = await hasRole(['sales', 'admin']);
|
||||
canViewDuplicates = isSalesOrAdmin(); // Use the convenience method
|
||||
console.log('[InterestDuplicateNotification] Role check result:', canViewDuplicates);
|
||||
} catch (roleError) {
|
||||
console.error('[InterestDuplicateNotification] Role check failed:', roleError);
|
||||
// Try to get user info directly as fallback
|
||||
const { isAdmin } = useAuthorization();
|
||||
canViewDuplicates = isAdmin();
|
||||
console.log('[InterestDuplicateNotification] Fallback admin check:', canViewDuplicates);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue