mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
refactor(web/fetchNui): fetch stub
Just a naive way to patch some common exploits.
This commit is contained in:
@@ -9,6 +9,12 @@
|
||||
* @return returnData - A promise for the data sent back by the NuiCallbacks CB argument
|
||||
*/
|
||||
|
||||
const fetch = window.fetch;
|
||||
// @ts-expect-error
|
||||
window.fetch = () => {};
|
||||
// @ts-expect-error
|
||||
window.XMLHttpRequest = window.fetch;
|
||||
|
||||
export async function fetchNui<T = any>(eventName: string, data?: any): Promise<T> {
|
||||
const options = {
|
||||
method: 'post',
|
||||
@@ -23,7 +29,6 @@ export async function fetchNui<T = any>(eventName: string, data?: any): Promise<
|
||||
: 'nui-frame-app';
|
||||
|
||||
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
||||
|
||||
const respFormatted = await resp.json();
|
||||
|
||||
return respFormatted;
|
||||
|
||||
Reference in New Issue
Block a user