1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-18 00:53:24 +02:00
parent e9d6fa5f24
commit 0b6e0f9708
47 changed files with 3824 additions and 0 deletions

View file

@ -0,0 +1,26 @@
export default async function fetchNui(eventName: string, data: unknown = {}) {
const options = {
method: "post",
headers: {
"Content-Type": "application/json; charset=UTF-8",
},
body: JSON.stringify(data),
};
const getResourceName = () => {
try {
// @ts-ignore
return window.GetParentResourceName();
} catch(err) {
return "ps-multijob";
}
}
const resourceName = getResourceName();
try {
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
return await resp.json();
} catch(err) {
}
}