diff --git a/luckydiamond/src/assets/js/moneyoperation/Claimmoney.js b/luckydiamond/src/assets/js/moneyoperation/Claimmoney.js index b6336ba..f25afdd 100644 --- a/luckydiamond/src/assets/js/moneyoperation/Claimmoney.js +++ b/luckydiamond/src/assets/js/moneyoperation/Claimmoney.js @@ -1,14 +1,39 @@ -import { Post } from '../rest/RestMethods.js'; -// import { BackendApiUrl } from '@/properties/Сonfig.js'; +// import { Post } from '../rest/RestMethods.js'; +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 }) + // 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 + }; + try { + const response = await fetch(`${BackendApiUrl}/api/payment/donate`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + redirect: "follow" + }); + + if (!response.ok) { + console.log("Fetch error:", response.status); + } console.log(response) - return response - } - catch (e) { - console.error('Error in ClaimMoney method: ', e) + + return await response.json(); + } catch (error) { + console.log("Fetch error:", error); } + } \ No newline at end of file diff --git a/luckydiamond/src/components/PaymentsModal.vue b/luckydiamond/src/components/PaymentsModal.vue index b612c46..c8cbfde 100644 --- a/luckydiamond/src/components/PaymentsModal.vue +++ b/luckydiamond/src/components/PaymentsModal.vue @@ -65,11 +65,11 @@ export default { console.log(newAmount) setTimeout(() => { try { - // GettingMoneyOperation(newAmount) - // .then((response) => { - // console.log('Payments Modal Working!: ', response) - // this.url = response.url - // }) + GettingMoneyOperation(newAmount) + .then((response) => { + console.log('Payments Modal Working!: ', response) + this.url = response.url + }) } catch (e) { console.error('Error in PaymentModal!', e)