Skip to content

Commit

Permalink
chore: update router rules
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Apr 26, 2024
1 parent 5848de3 commit fa6173e
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { needMigrate } from './lib/migrate'
import { hasPassword } from './lib/password'
import Wallet from './pages/wallet/Index.vue'
import { getCurrentAccountId } from './lib/account'
import { getCurrentWalletId, hasWallets } from './lib/wallet'
import { getCurrentWalletId, hasV3Wallets, hasWallets } from './lib/wallet'

const routes = [
{
Expand Down Expand Up @@ -496,29 +496,33 @@ const authPages = [
router.beforeEach(async (to, _, next) => {
if (to.fullPath !== '/migrateV2' && (await needMigrate())) {
next('/migrateV2')
} else if (!authPages.includes(to.path) && (!await hasPassword())) {
next('/wallet/set-password')
} else if (to.fullPath !== '/lock' && (await isLocked())) {
next('/lock')
} else if (!authPages.includes(to.path) && (!(await getCurrentAccountId()) || !(await getCurrentWalletId()))) {
if (await hasWallets()) {
next('/manage/wallets')
} else if (!authPages.includes(to.path)) {
if (!(await getCurrentAccountId()) || !(await getCurrentWalletId())) {
if (await hasWallets()) {
next('/manage/wallets')
} else {
goToTab('/welcome', true)
next('/welcome')
}
} else if (!(await hasPassword())) {
next('/wallet/set-password')
} else if (await isLocked()) {
next('/lock')
} else {
goToTab('/welcome', true)
next('/welcome')
}
} else {
if (['asset', 'token'].includes(to.name as string)) {
to.meta.headerTitle = to.params.symbol
}
if (['asset', 'token'].includes(to.name as string)) {
to.meta.headerTitle = to.params.symbol
}

if (to.name === 'send-token') {
to.meta.headerTitle = `Send ${to.params.symbol}`
}
if (to.name === 'send-token') {
to.meta.headerTitle = `Send ${to.params.symbol}`
}

if (to.path === '/wallet') {
assetList.value = []
if (to.path === '/wallet') {
assetList.value = []
}
next()
}
} else {
next()
}
})
Expand Down

0 comments on commit fa6173e

Please sign in to comment.