mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
Change rest method
This commit is contained in:
@@ -24,27 +24,48 @@ export async function Post(url = "", data = {}) {
|
||||
|
||||
export async function GetCurrentMoney(authToken, searchToken) {
|
||||
|
||||
const data = {
|
||||
AUTHTOKEN: authToken,
|
||||
SearchToken: searchToken
|
||||
};
|
||||
try {
|
||||
const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, {
|
||||
method: 'GET',
|
||||
redirect: 'follow',
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'AUTHTOKEN': authToken,
|
||||
'SearchToken': searchToken,
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
redirect: "follow"
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
console.log("Fetch error:", response.status);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
console.log("Fetch error:", error);
|
||||
}
|
||||
// try {
|
||||
// const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, {
|
||||
// method: 'GET',
|
||||
// redirect: 'follow',
|
||||
// headers: {
|
||||
// 'AUTHTOKEN': authToken,
|
||||
// 'SearchToken': searchToken
|
||||
// }
|
||||
// });
|
||||
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`HTTP error! status: ${response.status}`);
|
||||
// }
|
||||
|
||||
// const data = await response.json();
|
||||
// console.log(data);
|
||||
// return data;
|
||||
// } catch (error) {
|
||||
// console.error('There was a problem with the fetch operation:', error);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user