1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/um-idcard/web/js/fetchNui.js
2025-08-04 05:39:52 +02:00

18 lines
No EOL
430 B
JavaScript

const resource = GetParentResourceName();
export async function fetchNui(eventName, data) {
try {
const resp = await fetch(`https://${resource}/${eventName}`, {
method: 'post',
headers: {
'Content-Type': 'application/json; charset=UTF-8',
},
body: JSON.stringify(data),
});
return await resp.json();
} catch (error) {
console.error(error);
}
}