diff --git a/luckydiamond/src/components/PaymentsModal.vue b/luckydiamond/src/components/PaymentsModal.vue index b104172..630c14e 100644 --- a/luckydiamond/src/components/PaymentsModal.vue +++ b/luckydiamond/src/components/PaymentsModal.vue @@ -65,7 +65,7 @@ export default { ], data() { return { - amount: 1, + amount: 0, card: 0, clickedBtn: '', url: '', @@ -75,23 +75,22 @@ export default { }, watch: { amount(newAmount) { - console.log(newAmount) this.offBtn = true - console.log('OFFBTN', this.offBtn) - setTimeout(() => { - try { - GettingMoneyOperation(newAmount) - .then((response) => { - console.log('Payments Modal Working!: ', response) - this.url = response.url - this.offBtn = false - console.log('ONBTN', this.offBtn) - }) - } - catch (e) { - console.error('Error in PaymentModal!', e) - } - }, 2000) + if (this.amount > 0 && this.amount !== '' ) { + setTimeout(() => { + try { + GettingMoneyOperation(newAmount) + .then((response) => { + console.log('Payments Modal Working!: ', response) + this.url = response.url + this.offBtn = false + }) + } + catch (e) { + console.error('Error in PaymentModal!', e) + } + }, 2000) + } } }, methods: { diff --git a/luckydiamond/src/pages/ProfilePage.vue b/luckydiamond/src/pages/ProfilePage.vue index 834926a..4654eaa 100644 --- a/luckydiamond/src/pages/ProfilePage.vue +++ b/luckydiamond/src/pages/ProfilePage.vue @@ -59,6 +59,7 @@ import HeaderComponent from "@/components/HeaderComponent.vue"; import PaymentsModal from "@/components/PaymentsModal.vue"; import { GetCookie } from "@/assets/js/storage/CookieStorage"; import '@/assets/css/PagesStyles/profile.css' +import {GetCurrentMoney} from "@/assets/js/rest/RestMethods"; export default { components: { HeaderComponent, AsideBarComponent, ChatComponent, PaymentsModal }, @@ -66,7 +67,7 @@ export default { return { username: 'Artemka', imageUrl: '', - balance: 25000, + balance: 0, openModal: false, payments: true, arrayHistory: [], @@ -74,6 +75,16 @@ export default { }, created() { this.username = GetCookie('SpUserName') + + GetCurrentMoney(GetCookie('AUTHTOKEN'), GetCookie('SearchToken')) + .then((response) => { + this.balance = response.currentMoney + console.log('balance in profile', this.balance) + }) + .catch((error) => { + console.error('error in profile, get money', error) + }) + this.imageUrl = `https://visage.surgeplay.com/front/256/${this.username}` }, methods: {