Clean up ether store

Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR
2023-01-19 19:42:57 -03:00
parent 2b61625e1e
commit d7723ebf07
7 changed files with 41 additions and 75 deletions

View File

@@ -19,7 +19,7 @@ const handleInputEvent = (event: any): void => {
tokenValue.value = Number(value);
if (decimalCount(tokenValue.value) > 2) {
if (decimalCount(String(tokenValue.value)) > 2) {
validDecimals.value = false;
enableSelectButton.value = false;
return;

View File

@@ -35,7 +35,10 @@ const handleInputEvent = (event: any): void => {
validDecimals.value = true;
};
const handleButtonClick = async (offer: string, pixKey: string): Promise<void> => {
const handleButtonClick = async (
offer: string,
pixKey: string
): Promise<void> => {
if (walletAddress.value) emit("approveTokens", { offer, pixKey });
else await connectProvider();
};

View File

@@ -10,7 +10,7 @@ import polygonImage from "../assets/polygon.svg";
// Store reference
const etherStore = useEtherStore();
const { walletAddress, balance, sellerView } = storeToRefs(etherStore);
const { walletAddress, sellerView } = storeToRefs(etherStore);
const menuOpenToggle = ref<boolean>(false);
const menuHoverToggle = ref<boolean>(false);
@@ -33,11 +33,6 @@ const formatWalletAddress = (): string => {
return `${initialText}...${finalText}`;
};
const formatWalletBalance = (): string => {
const fixed = Number(balance.value);
return fixed.toFixed(2);
};
const disconnectUser = (): void => {
etherStore.setWalletAddress("");
closeMenu();