Integrate and componentize QRCode screen

This commit is contained in:
enzoggqs
2022-12-05 23:20:18 -03:00
parent 5c0bc4922d
commit cfaa1b9342
3 changed files with 22 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ import p2pix from "../utils/smart_contract_files/P2PIX.json";
import addresses from "../utils/smart_contract_files/localhost.json";
import { useEtherStore } from "@/store/ether";
import { ethers } from "ethers";
import QrCodeForm from "./QrCodeForm.vue";
import QrCodeForm from "../components/QrCodeForm.vue";
import { storeToRefs } from "pinia";
@@ -21,7 +21,9 @@ enum Step {
// States
const etherStore = useEtherStore();
const { loadingLock } = storeToRefs(etherStore);
const flowStep = ref<Step>(Step.Search)
const flowStep = ref<Step>(Step.Search);
const pixTarget = ref<string>("");
const tokens = ref<number>();
const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
// finish buy screen
@@ -33,6 +35,8 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
.then((deposit) => (depositDetail = deposit));
console.log(tokenValue);
console.log(depositDetail);
tokens.value = tokenValue;
pixTarget.value = depositDetail?.pixTarget;
// Makes lock with deposit ID and the Amount
if (depositDetail) {
@@ -70,7 +74,11 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
<template>
<SearchComponent v-if="(flowStep == Step.Search)" @token-buy="confirmBuyClick" />
<div v-if="(flowStep == Step.Buy)">
<QrCodeForm v-if="!loadingLock"/>
<QrCodeForm
:pixTarget="pixTarget"
:tokenValue="tokens"
v-if="!loadingLock"
/>
<ValidationComponent v-if="loadingLock"/>
</div>
</template>