mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
import { BackendApiUrl } from '@/properties/Сonfig.js';
|
||
|
||
|
||
export async function Post(url = "", data = {}) {
|
||
try {
|
||
const response = await fetch(url, {
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
},
|
||
body: JSON.stringify(data),
|
||
redirect: "follow"
|
||
});
|
||
|
||
if (!response.ok) {
|
||
console.log("Fetch error:", response.status);
|
||
}
|
||
|
||
return await response.json();
|
||
} catch (error) {
|
||
console.log("Fetch error:", error);
|
||
}
|
||
}
|
||
|
||
export async function GetCurrentMoney(authToken, searchToken) {
|
||
|
||
try {
|
||
const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, {
|
||
method: 'GET',
|
||
mode: 'no-cors',
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
'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);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|