wuhu-torn-helper/src/ts/func/utils/fetchCurrentMoney.ts
2023-06-14 18:02:59 +08:00

25 lines
796 B
TypeScript

const init: RequestInit = {
"headers": {
"accept": "*/*",
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest"
},
"referrer": "https://www.torn.com/companies.php",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
};
export const fetchCurrentMoney = async (action?: string): Promise<number> => {
return Number(await (await fetch(window.addRFC("/inputMoneyAction.php?step=" + (action ? action : "generalAction")), init)).text());
};
export const fetchCurrentCompanyAvailableMoney = () => {
return fetchCurrentMoney("companyAction");
};