init dialogue and progressbar bananza
Added dialogue system initial upload. Some modifications needed but good default. Standardized input and output for progressbar. Accepts ox and qb (progressbar)
This commit is contained in:
1 parent
df5dd4ffa4
commit
58782dfcd0
24 files changed
+12762
-89
No files matched your search
@@ -0,0 +1,26 @@
|
||||
export const fetchNui = async (cbName, data = {}) => {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
};
|
||||
|
||||
try {
|
||||
const resourceName = window.GetParentResourceName?.() || '';
|
||||
const resp = await fetch(`https://${resourceName}/${cbName}`, options);
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error(`HTTP error! status: ${resp.status}`);
|
||||
}
|
||||
|
||||
return await resp.json();
|
||||
} catch (error) {
|
||||
console.error(`Fetch error for ${cbName}:`, error);
|
||||
if (!window.GetParentResourceName?.()) {
|
||||
console.error('Resource name is null - are you testing in browser?');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user