mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
fix: license banner using message type (#9209)
## About the changes Actually uses messageType and maps from warn to warning.
This commit is contained in:
parent
640db0c057
commit
ae65919f92
@ -32,8 +32,7 @@ export const LicenseBanner = () => {
|
||||
if (!license.loading && !license.error && licenseInfo.message) {
|
||||
const banner = {
|
||||
message: licenseInfo.message,
|
||||
variant:
|
||||
licenseInfo.messageType ?? ('warning' as BannerVariant),
|
||||
variant: mapToVariant(licenseInfo.messageType),
|
||||
sticky: true,
|
||||
};
|
||||
return <Banner key={banner.message} banner={banner} />;
|
||||
@ -43,3 +42,15 @@ export const LicenseBanner = () => {
|
||||
|
||||
return null;
|
||||
};
|
||||
function mapToVariant(
|
||||
messageType: string | undefined,
|
||||
): BannerVariant | undefined {
|
||||
if (messageType) {
|
||||
switch (messageType) {
|
||||
case 'warn':
|
||||
return 'warning';
|
||||
default:
|
||||
return messageType as BannerVariant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ export const useLicenseCheck = (): LicenseInfo => {
|
||||
return {
|
||||
isValid: data?.isValid,
|
||||
message: data?.message,
|
||||
messageType: data?.messageType,
|
||||
loading: !error && !data,
|
||||
reCheckLicense: () => mutate(),
|
||||
error,
|
||||
|
Loading…
Reference in New Issue
Block a user