Skip to content

Commit

Permalink
🚸 Improve login UX flow
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Sep 18, 2024
1 parent 1015ced commit e6861c5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,21 @@
]"
>
<div
v-if="currentAddress"
v-if="isLoading"
class="flex items-center justify-center"
>
<ProgressIndicator />
</div>
<div
v-else-if="sessionWallet"
:class="[
'relative',
'w-[180px]',
]"
>
<Button
preset="secondary"
:title="currentAddress"
:title="sessionWallet"
>
<template
v-if="isUsingMobileApp"
Expand All @@ -104,7 +110,7 @@
'overflow-hidden',
'overflow-ellipsis',
]"
>{{ currentAddress }}</div>
>{{ sessionWallet }}</div>
</Button>
<Button
:class="[
Expand Down Expand Up @@ -168,6 +174,7 @@ export default class AppHeader extends Vue {
@walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise<any>
@walletModule.Getter('getWalletAddress') currentAddress!: string
@walletModule.Getter('getSigner') signer!: any
@bookApiModule.Getter('getSessionWallet') sessionWallet!: string
@bookApiModule.Action('authenticate') authenticate!: ({ inputWallet, signature }: { inputWallet?: string, signature?: any }) => Promise<any>
@bookApiModule.Action('clearSession') clearSession!: () => void
Expand Down Expand Up @@ -220,15 +227,17 @@ export default class AppHeader extends Vue {
'write:nftcollection',
])
if (!signature) { return }
await this.authenticate({inputWallet:this.currentAddress, signature})
await this.authenticate({ inputWallet: this.currentAddress, signature })
}
} catch (error) {
this.disconnectWallet()
this.clearSession()
// eslint-disable-next-line no-console
console.error('handleConnectWalletButtonClick error', error)
}
this.isLoading = false
finally {
this.isLoading = false
}
}
}
</script>

0 comments on commit e6861c5

Please sign in to comment.