Merge branch 'creation_of_purchase_screens' of https://github.com/liftlearning/P2Pix-Front-End into creation_of_purchase_screens

This commit is contained in:
enzoggqs 2022-12-05 23:26:12 -03:00
commit f2b7617726

View File

@ -12,10 +12,9 @@ import { ethers } from "ethers";
import QrCodeForm from "../components/QrCodeForm.vue"; import QrCodeForm from "../components/QrCodeForm.vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
enum Step { enum Step {
Search, Search,
Buy Buy,
} }
// States // States
@ -29,7 +28,7 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
// finish buy screen // finish buy screen
console.log(selectedDeposit); console.log(selectedDeposit);
let depositDetail; let depositDetail;
const depositId = selectedDeposit["args"]["depositID"] const depositId = selectedDeposit["args"]["depositID"];
await blockchain await blockchain
.mapDeposits(depositId) .mapDeposits(depositId)
.then((deposit) => (depositDetail = deposit)); .then((deposit) => (depositDetail = deposit));
@ -40,16 +39,12 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
// Makes lock with deposit ID and the Amount // Makes lock with deposit ID and the Amount
if (depositDetail) { if (depositDetail) {
flowStep.value = Step.Buy flowStep.value = Step.Buy;
etherStore.setLoadingLock(true); etherStore.setLoadingLock(true);
const lock = await blockchain.addLock(
depositId,
tokenValue
).catch((_error) => {
flowStep.value = Step.Search
})
console.log(lock); await blockchain.addLock(depositId, tokenValue).catch((_error) => {
flowStep.value = Step.Search;
});
// (TO DO) Tirar isso daqui // (TO DO) Tirar isso daqui
const window_ = window as any; const window_ = window as any;