1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/utils/formatAccessText.ts

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;
};