Skip to content
Snippets Groups Projects
Commit 669393f2 authored by Victor Ekholt Gunrell Kaste's avatar Victor Ekholt Gunrell Kaste
Browse files

feat: made checking boxes transfer money

parent 3c41fcba
No related branches found
No related tags found
1 merge request!88Feat/redesign roadmap2
<script lang="ts">
import {CategoryScale, Chart as ChartJS, Legend, LinearScale, LineElement, PointElement, Title, Tooltip} from 'chart.js'
import {Line} from 'vue-chartjs'
import type {ChallengeDTO, CreateGoalDTO, GoalDTO, MarkChallengeDTO} from "@/api";
import {
type ChallengeDTO,
type CreateGoalDTO,
type GoalDTO,
type MarkChallengeDTO,
TransactionControllerService, type TransactionDTO,
UserService
} from "@/api";
import {GoalService} from '@/api'
import {useUserInfoStore} from "@/stores/UserStore";
......@@ -171,6 +178,7 @@ export default {
}
this.addDataToChart(amount, dateString);
await this.transferMoney(amount)
this.calculateSavedSoFar();
} catch (error: any) {
console.log(error.message);
......@@ -334,8 +342,18 @@ export default {
}
},
transferMoney(amount: number) {
//need users bank accounts
async transferMoney(amount: number) {
let response = await UserService.getUser()
let spendingAccount = response.checkingAccount?.bban
let savingAccount = response.savingsAccount?.bban
const transactionPayload: TransactionDTO = {
debtorBBAN: spendingAccount,
creditorBBAN: savingAccount,
amount: amount,
}
await TransactionControllerService.transferToSelf({requestBody: transactionPayload})
},
},
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment