5180 fichiers 38.5 Mo 0 téléchargements 185 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / api / octane / GetConfigurationValue.ts
GetConfigurationValue.ts 885 o Télécharger le fichier
import { GetConfiguration } from '@octane/renderer';

export function GetConfigurationValue<T = string>(key: string, value: T = null): T {
    return GetConfiguration().getValue(key, value);
}

export function GetOptionalConfigurationValue<T = string>(key: string, value: T = null): T {
    return GetConfiguration().definitions.has(key) ? GetConfiguration().getValue(key, value) : value;
}

/**
 * A configuration value that is an object of settings (`hc.center`, `catalog.links`, ...), or an empty one when the
 * key is missing or holds something else, so reading one field of it never throws on a partial or older config.
 */
export function GetConfigurationRecord(key: string): Record<string, any> {
    const value = GetConfiguration().getValue<unknown>(key, null);

    return value && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, any>) : {};
}
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser