Skip to content

Commit

Permalink
Initialize listeners in BreakdownChart.vue when user is signed in
Browse files Browse the repository at this point in the history
  • Loading branch information
ccali11 committed Jul 14, 2023
1 parent cf017a9 commit b5b9e44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/composables/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ export default function useWallet() {
setPrimaryAddress('')
setUserAnalytics()
await refreshBreakdown()
// loadingUserWallets.value = false
// TODO: Fix bug that doesn't allow you to log in without refreshing page after a user logs out
window.location.reload()
console.log('user.value :>> ', user.value)
}

Expand Down
9 changes: 8 additions & 1 deletion apps/web/src/pages/overview/components/BreakdownChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import LineChartJS from '@/components/charts/LineChartJS.vue'
import { onMounted, ref, watch} from 'vue'
import useContracts from '@/composables/contracts'
import useUsers from '@/composables/users'
import useEthers from '@/composables/ethers'
import { ProviderString } from '@casimir/types'
const { currentStaked, refreshBreakdown, stakingRewards, totalWalletBalance } = useContracts()
const { currentStaked, listenForContractEvents, refreshBreakdown, stakingRewards, totalWalletBalance } = useContracts()
const { user, getUserAnalytics, userAnalytics } = useUsers()
const { listenForTransactions } = useEthers()
const chardId = ref('cross_provider_chart')
const selectedTimeframe = ref('historical')
Expand Down Expand Up @@ -101,6 +103,11 @@ onMounted(async () => {
await getUserAnalytics()
setChartData()
await refreshBreakdown()
// TODO: Potentially find a better place to initialize these listeners
// Doing this here because currently we're currently initializing listeners on connectWallet
// which isn't used if user is already signed in
listenForContractEvents()
listenForTransactions()
} else {
setChartData()
}
Expand Down

0 comments on commit b5b9e44

Please sign in to comment.