mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +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) {
|
export async function GetCurrentMoney(authToken, searchToken) {
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
AUTHTOKEN: authToken,
|
||||||
|
SearchToken: searchToken
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, {
|
const response = await fetch(url, {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
redirect: 'follow',
|
|
||||||
headers: {
|
headers: {
|
||||||
'AUTHTOKEN': authToken,
|
"Content-Type": "application/json",
|
||||||
'SearchToken': searchToken,
|
},
|
||||||
'Access-Control-Allow-Origin': '*'
|
body: JSON.stringify(data),
|
||||||
}
|
redirect: "follow"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
console.log("Fetch error:", response.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
return await response.json();
|
||||||
console.log(data);
|
|
||||||
return data;
|
|
||||||
} catch (error) {
|
} 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