Allow defining icon

- Adds warning class
This commit is contained in:
Kakarot
2024-02-17 06:13:47 -06:00
parent 40df11027b
commit 5c60c94197
7 changed files with 119 additions and 109 deletions
+9 -10
View File
@@ -23,24 +23,23 @@ export let NOTIFY_CONFIG = null;
* @returns NotiVariantData
**/
export const determineStyleFromVariant = (variant) => {
const variantData = NOTIFY_CONFIG.VariantDefinitions[variant];
if (!variantData)
throw new Error(`Style of type: ${variant}, does not exist in the config`);
return variantData;
const variantData = NOTIFY_CONFIG.VariantDefinitions[variant];
if (!variantData) throw new Error(`Style of type: ${variant}, does not exist in the config`);
return variantData;
};
// Fetch and set NOTIFY_CONFIG from client script callback
export const fetchNotifyConfig = async () => {
NOTIFY_CONFIG = await fetchNui("getNotifyConfig", {}, BrowserMockConfigData);
if (isEnvBrowser() || DEV_MODE) {
console.log("Fetched Config:");
console.dir(NOTIFY_CONFIG);
}
NOTIFY_CONFIG = await fetchNui("getNotifyConfig", {}, BrowserMockConfigData);
if (isEnvBrowser() || DEV_MODE) {
console.log("Fetched Config:");
console.dir(NOTIFY_CONFIG);
}
};
// We specifically wait for all other files to load
// just in case of a race condition between client handlers
// and NUI fetch call
window.addEventListener("load", async () => {
await fetchNotifyConfig();
await fetchNotifyConfig();
});