mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
added request post to withdrawmoney
This commit is contained in:
@@ -2,17 +2,6 @@
|
||||
import { BackendApiUrl } from '@/properties/Сonfig.js';
|
||||
|
||||
export async function GettingMoneyOperation(amount) {
|
||||
// try {
|
||||
// const response = await Post('https://spsystemcore20231122004605.azurewebsites.net/api/payment/donate', { request: amount })
|
||||
|
||||
// console.log(response)
|
||||
// return response
|
||||
// }
|
||||
// catch (e) {
|
||||
// console.error('Error in ClaimMoney method: ', e)
|
||||
// }
|
||||
|
||||
|
||||
const data = {
|
||||
Amount: amount
|
||||
};
|
||||
@@ -34,4 +23,35 @@ export async function GettingMoneyOperation(amount) {
|
||||
} catch (error) {
|
||||
console.log("Fetch error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function WithdrawMoneyOperation(amount, card, captchaToken, searchToken, authToken) {
|
||||
const data = {
|
||||
amount: amount,
|
||||
card: card,
|
||||
reCaptchaToken: captchaToken,
|
||||
searchToken: searchToken,
|
||||
authtoken: authToken
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${BackendApiUrl}/payment/TransferMoneyToSpWorlds`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
redirect: "follow"
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
console.log("fetch error withdrawmoney operation status:", response.status)
|
||||
}
|
||||
|
||||
console.log(response)
|
||||
return await response.json()
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`fetch error withdrawmoney operation - ${error}`)
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,8 @@
|
||||
<script>
|
||||
import "@/assets/css/ComponentsStyles/payments-modal.css";
|
||||
import PaymentsModalNumbers from "@/mocks/PaymentsModalNumbers";
|
||||
import { GettingMoneyOperation } from "@/assets/js/moneyoperation/Claimmoney";
|
||||
import { GettingMoneyOperation, WithdrawMoneyOperation } from "@/assets/js/moneyoperation/Claimmoney";
|
||||
import { GetCookie } from "@/assets/js/storage/CookieStorage";
|
||||
import CaptchaComponent from "@/components/CaptchaComponent.vue";
|
||||
|
||||
export default {
|
||||
@@ -101,10 +102,11 @@ export default {
|
||||
props: ["payments"],
|
||||
data() {
|
||||
return {
|
||||
amount: 0,
|
||||
amountWithdraw: 0,
|
||||
card: 0,
|
||||
captchaToken: '',
|
||||
amount: 1,
|
||||
amountWithdraw: 1,
|
||||
amountSave: 1,
|
||||
card: '',
|
||||
captchaToken: null,
|
||||
clickedBtn: "",
|
||||
url: "",
|
||||
offBtn: true,
|
||||
@@ -131,7 +133,26 @@ export default {
|
||||
}
|
||||
},
|
||||
amountWithdraw(newAmount) {
|
||||
console.log(newAmount)
|
||||
if (newAmount > 0) {
|
||||
this.amountSave = newAmount
|
||||
console.log(`save amount = ${this.amountSave}`)
|
||||
}
|
||||
},
|
||||
captchaToken(TokenClaim) {
|
||||
if(TokenClaim !== '' && this.amountSave > 0) {
|
||||
this.offBtn = true
|
||||
setTimeout(() => {
|
||||
try {
|
||||
WithdrawMoneyOperation(this.amountSave, this.card.toString(), TokenClaim, GetCookie('SearchToken'), GetCookie('AUTHTOKEN')).then((response) => {
|
||||
console.log(`work withdraw - ${response}`)
|
||||
this.offBtn = false
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`Error in wihdrawmoney operation - ${e}`)
|
||||
}
|
||||
}, 4000)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user