mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
Allow defining icon
- Adds warning class
This commit is contained in:
+9
-10
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user