mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00

17 lines
362 B
TypeScript
17 lines
362 B
TypeScript
export const ACCESS_DENIED_TEXT = 'Access denied';
|
|
|
|
export const formatAccessText = (
|
|
hasAccess: boolean,
|
|
hasAccessText?: string | null,
|
|
): string | undefined | null => {
|
|
if (hasAccess) {
|
|
return hasAccessText;
|
|
}
|
|
|
|
if (hasAccessText) {
|
|
return `${hasAccessText} (${ACCESS_DENIED_TEXT})`;
|
|
}
|
|
|
|
return ACCESS_DENIED_TEXT;
|
|
};
|