mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
17 lines
347 B
TypeScript
17 lines
347 B
TypeScript
|
export const ACCESS_DENIED_TEXT = 'Access denied';
|
||
|
|
||
|
export const formatAccessText = (
|
||
|
hasAccess: boolean,
|
||
|
hasAccessText?: string
|
||
|
): string | undefined => {
|
||
|
if (hasAccess) {
|
||
|
return hasAccessText;
|
||
|
}
|
||
|
|
||
|
if (hasAccessText) {
|
||
|
return `${hasAccessText} (${ACCESS_DENIED_TEXT})`;
|
||
|
}
|
||
|
|
||
|
return ACCESS_DENIED_TEXT;
|
||
|
};
|