Skip to content

Commit

Permalink
🚸 Auto connect wallet if session exists
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jan 18, 2024
1 parent 6cb531e commit 3414f08
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/WalletHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ const { connect, disconnect } = store
const portfolioURL = computed(() => getPortfolioURL(wallet.value))
onMounted(async () => {
try {
const payload = window.localStorage.getItem('likecoin_nft_book_press_token')
if (payload) {
const { wallet: storedWallet } = JSON.parse(payload)
if (storedWallet) { await connect() }
}
} catch {}
})
function onClickDisconnect () {
disconnect()
window.localStorage.removeItem('likecoin_nft_book_press_token')
Expand Down

0 comments on commit 3414f08

Please sign in to comment.