refactor(admin-permissions, reports): normalize admin account kind and improve currency fallback logic
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Refactored the admin account kind resolution to utilize a normalization function for better consistency across the application. Updated the currency fallback logic in the reports console to prioritize enabled and bettable currencies, enhancing the accuracy of currency display.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { normalizeAdminAccountKind } from "@/lib/admin-account-kind";
|
||||
import {
|
||||
adminHasAnyPermission,
|
||||
adminHasAnyPermissionCode,
|
||||
@@ -10,8 +11,9 @@ export function resolveAdminAccountKind(profile: AdminProfile | null | undefined
|
||||
if (!profile) {
|
||||
return null;
|
||||
}
|
||||
if (profile.account_kind) {
|
||||
return profile.account_kind === "site_operator" ? "site_admin" : profile.account_kind;
|
||||
const normalized = normalizeAdminAccountKind(profile.account_kind);
|
||||
if (normalized) {
|
||||
return normalized;
|
||||
}
|
||||
if (profile.is_super_admin) {
|
||||
return "super_admin";
|
||||
|
||||
Reference in New Issue
Block a user