Skip to content

Commit

Permalink
Fix wallet check (#7829)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Mar 13, 2024
1 parent f91ac3f commit f7e8dee
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/web/src/common/store/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export function* fetchAccountAsync({ isSignUp = false }) {
const clientOrigin = isNativeMobile
? 'mobile'
: isElectron
? 'desktop'
: 'web'
? 'desktop'
: 'web'
fingerprintClient.identify(account.user_id, clientOrigin)

yield call(recordIPIfNotRecent, account.handle)
Expand All @@ -196,15 +196,27 @@ export function* fetchLocalAccountAsync() {

yield put(accountActions.fetchAccountRequested())

const audiusLibs = yield call([audiusBackendInstance, audiusBackendInstance.getAudiusLibs])
const wallet = yield call([audiusLibs.web3Manager, audiusLibs.web3Manager.getWalletAddress])
const audiusLibs = yield call([
audiusBackendInstance,
audiusBackendInstance.getAudiusLibs
])
const wallet = yield call([
audiusLibs.web3Manager,
audiusLibs.web3Manager.getWalletAddress
])
const cachedAccount = yield call([localStorage, 'getAudiusAccount'])
const cachedAccountUser = yield call([localStorage, 'getAudiusAccountUser'])
const currentUserExists = yield call([localStorage, 'getCurrentUserExists'])

const walletMatches = wallet.toLowerCase() === cachedAccountUser.wallet.toLowerCase()
const walletMatches =
wallet.toLowerCase() === cachedAccountUser?.wallet.toLowerCase()

if (cachedAccount && cachedAccountUser && !cachedAccountUser.is_deactivated && walletMatches) {
if (
cachedAccount &&
cachedAccountUser &&
!cachedAccountUser.is_deactivated &&
walletMatches
) {
yield call(
cacheAccount,
{ ...cachedAccountUser, local: true },
Expand Down

0 comments on commit f7e8dee

Please sign in to comment.