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.
25 lines
602 B
TypeScript
25 lines
602 B
TypeScript
import type { AdminAccountKind } from "@/types/api/admin-auth";
|
|
|
|
/** 旧版 localStorage 可能仍存 `site_operator`,归一为 `site_admin`。 */
|
|
export function normalizeAdminAccountKind(
|
|
kind: string | undefined | null,
|
|
): AdminAccountKind | undefined {
|
|
if (!kind) {
|
|
return undefined;
|
|
}
|
|
if (kind === "site_operator") {
|
|
return "site_admin";
|
|
}
|
|
if (
|
|
kind === "super_admin"
|
|
|| kind === "site_admin"
|
|
|| kind === "site_finance"
|
|
|| kind === "site_cs"
|
|
|| kind === "agent_operator"
|
|
|| kind === "platform_account"
|
|
) {
|
|
return kind;
|
|
}
|
|
return undefined;
|
|
}
|