Add connect wallet button on seller view when wallet is not connected
This commit is contained in:
parent
51cf33d22b
commit
6ba113ba86
@ -3,8 +3,14 @@ import { ref } from "vue";
|
|||||||
import CustomButton from "../CustomButton.vue";
|
import CustomButton from "../CustomButton.vue";
|
||||||
import { debounce } from "@/utils/debounce";
|
import { debounce } from "@/utils/debounce";
|
||||||
import { decimalCount } from "@/utils/decimalCount";
|
import { decimalCount } from "@/utils/decimalCount";
|
||||||
|
import { useEtherStore } from "@/store/ether";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
import { connectProvider } from "@/blockchain/provider";
|
||||||
|
|
||||||
// Reactive state
|
// Reactive state
|
||||||
|
const etherStore = useEtherStore();
|
||||||
|
const { walletAddress } = storeToRefs(etherStore);
|
||||||
|
|
||||||
const offer = ref<string | number>("");
|
const offer = ref<string | number>("");
|
||||||
const pixKey = ref<string>("");
|
const pixKey = ref<string>("");
|
||||||
|
|
||||||
@ -28,6 +34,11 @@ const handleInputEvent = (event: any): void => {
|
|||||||
}
|
}
|
||||||
validDecimals.value = true;
|
validDecimals.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleButtonClick = async (): Promise<void> => {
|
||||||
|
if (walletAddress.value) emit("approveTokens", { offer, pixKey });
|
||||||
|
else await connectProvider();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -90,8 +101,8 @@ const handleInputEvent = (event: any): void => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CustomButton
|
<CustomButton
|
||||||
:text="'Aprovar tokens'"
|
:text="walletAddress ? 'Aprovar tokens' : 'Conectar Carteira'"
|
||||||
@buttonClicked="emit('approveTokens', { offer, pixKey })"
|
@buttonClicked="handleButtonClick()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user