Skip to content

Commit

Permalink
fix: Points number displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed May 21, 2024
1 parent 36f9ff0 commit fda3b6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/AccountButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@
<script setup>
import { ethers } from 'ethers';
import { useAccount } from '../stores/account';
import { usePoints } from 'stores/points';
console.log(ethers);
const account = useAccount();
async function eth_web3_login() {
const points = usePoints();
console.log(window.ethereum);
if (window.ethereum) {
try {
Expand All @@ -69,6 +72,7 @@ async function eth_web3_login() {
alert('Error getting web3 account');
return;
}
await points.update();
}
</script>

Expand Down
6 changes: 5 additions & 1 deletion src/stores/points.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ export const usePoints = defineStore('points', {

getAddressRealtimePoints(address) {
const pendingInfo = this.getAddressRealtimePendingPointsInfo(address);
return this.getAddressPoints(address) + pendingInfo.pending;
const addressPoints = this.getAddressPoints(address);
if (Number.isNaN(pendingInfo.pending)) {
return addressPoints;
}
return addressPoints + pendingInfo.pending;
},
},
});

0 comments on commit fda3b6c

Please sign in to comment.