diff --git a/layouts/wallet.vue b/layouts/wallet.vue
index 54377b81..8773e5c4 100644
--- a/layouts/wallet.vue
+++ b/layouts/wallet.vue
@@ -1,12 +1,20 @@
-
+
+
+
+
+
+
@@ -28,6 +36,7 @@ export default class WalletLayout extends Vue {
@walletModule.Action('initWallet') initWallet!: (params: { method: any, accounts: any, offlineSigner?: any }) => Promise
@walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise
@walletModule.Getter('getSigner') signer!: any
+ @bookApiModule.Getter('getSessionWallet') sessionWallet!: string
@bookApiModule.Action('restoreSession') restoreSession!: () => void
@bookApiModule.Action('authenticate') authenticate!: ({ inputWallet, signature }: { inputWallet?: string, signature?: any }) => Promise
@bookApiModule.Action('clearSession') clearSession!: () => void
@@ -38,13 +47,16 @@ export default class WalletLayout extends Vue {
severity: string
) => void
+ isSignInLoading = false
+
get isHideFooter() {
return this.$route.path.includes('/nft/purchase/') || this.$route.query.layout === 'popup';
}
async mounted() {
await this.restoreSession()
- if (!this.walletAddress) {
+ if (!this.sessionWallet) {
+ this.isSignInLoading = true
const connection = await this.openConnectWalletModal({
language: this.$i18n.locale.split('-')[0],
fullPath: this.$route.fullPath,
@@ -81,13 +93,18 @@ export default class WalletLayout extends Vue {
signature,
})
}
- this.$router.go(-1)
+ else {
+ this.$router.go(-1)
+ }
} catch (error) {
this.disconnectWallet()
this.clearSession()
// eslint-disable-next-line no-console
console.error('handleConnectWalletButtonClick error', error)
}
+ finally {
+ this.isSignInLoading = false
+ }
}
}
diff --git a/locales/en.json b/locales/en.json
index 275821e5..7ffa9dbb 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -99,6 +99,7 @@
"FileUploaded.guide.title": "Upload only mode. Files uploaded",
"general.closeWindow": "Close Window",
"general.loading": "Loading",
+ "general.signIn.loading": "Signing in...",
"HomePage.button.faucet": "Faucet",
"HomePage.button.help": "Help",
"HomePage.button.learnmore": "Learn more",
diff --git a/pages/auth/redirect.vue b/pages/auth/redirect.vue
index 4fee2771..6580b47b 100644
--- a/pages/auth/redirect.vue
+++ b/pages/auth/redirect.vue
@@ -58,7 +58,7 @@ export default class RedirectPage extends Vue {
'write:nftcollection',
])
if (!signature) { return }
- await this.authenticate({inputWallet:this.currentAddress, signature})
+ await this.authenticate({ inputWallet: this.currentAddress, signature })
}
let postAuthRoute = '/';
if (window.sessionStorage) {
diff --git a/pages/nft/url/index.vue b/pages/nft/url/index.vue
index 26812550..b0c2703f 100644
--- a/pages/nft/url/index.vue
+++ b/pages/nft/url/index.vue
@@ -159,6 +159,7 @@ const base64toBlob = (base64Data: string, contentType: string, sliceSize = 512)
const iscnModule = namespace('iscn')
const walletModule = namespace('wallet')
+const bookApiModule = namespace('book-api')
export enum ErrorType {
INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE',
@@ -193,6 +194,9 @@ export default class FetchIndex extends Vue {
@walletModule.Getter('getWalletAddress') address!: string
@walletModule.Getter('getSigner') signer!: OfflineSigner | null
+ @bookApiModule.Getter('getSessionWallet') sessionWallet!: string
+
+
state = State.INIT
url = this.$route.query.url as string || ''
platform = this.$route.query.platform as string || ''
@@ -365,7 +369,7 @@ export default class FetchIndex extends Vue {
const res = await this.fetchISCNById(this.iscnId)
if (res) {
const iscnOwner = res.owner
- if (iscnOwner !== this.address) {
+ if (iscnOwner !== this.sessionWallet) {
this.toggleSnackbar(ErrorType.USER_NOT_ISCN_OWNER)
}
}
@@ -562,7 +566,7 @@ export default class FetchIndex extends Vue {
}
switch (this.state) {
case State.INIT: {
- if (this.ownerWallet && this.address !== this.ownerWallet) {
+ if (this.ownerWallet && this.sessionWallet !== this.ownerWallet) {
throw new Error('PLEASE_USE_OWNER_WALLET_TO_SIGN')
}
if (this.iscnPrefixRegex.test(this.url)) {
diff --git a/pages/view/_iscnId/index.vue b/pages/view/_iscnId/index.vue
index 78f44abc..77f48b35 100644
--- a/pages/view/_iscnId/index.vue
+++ b/pages/view/_iscnId/index.vue
@@ -483,7 +483,7 @@ import {
const iscnModule = namespace('iscn')
-const walletModule = namespace('wallet')
+const bookApiModule = namespace('book-api')
export enum ErrorMessage {
statusCode400 = 'not iscn id or tx hash',
@@ -617,14 +617,15 @@ export default class ViewIscnIdPage extends Vue {
arg0: string
) => Promise<{ records: ISCNRecordWithID[] }>
- @walletModule.Getter('getWalletAddress') currentAddress!: string
+ @bookApiModule.Getter('getSessionWallet') sessionWallet!: string
+
get isShowMintButton() {
return !this.isPreminted && this.isIscnOwner
}
get isIscnOwner() {
- return Boolean(this.iscnOwner === this.currentAddress)
+ return Boolean(this.iscnOwner === this.sessionWallet)
}
get showContentLinks() {
diff --git a/pages/works/index.vue b/pages/works/index.vue
index 45a734f0..94aeb2dd 100644
--- a/pages/works/index.vue
+++ b/pages/works/index.vue
@@ -109,7 +109,7 @@ import { LIKER_LAND_URL } from '~/constant'
import { ISCNRecordWithID } from '~/utils/cosmos/iscn/iscn.type'
const iscnModule = namespace('iscn')
-const walletModule = namespace('wallet')
+const bookApiModule = namespace('book-api')
@Component({
layout: 'wallet',
@@ -117,14 +117,16 @@ const walletModule = namespace('wallet')
export default class WorksIndexPageExtends extends Vue {
pageNumber = Number(this.$route.query.page) || 0
- @walletModule.Getter('getWalletAddress') currentAddress!: string
@iscnModule.Getter('getISCNChunks') recordChunks!: ISCNRecordWithID[][]
@iscnModule.Getter('getIsLoading') isLoading!: boolean
@iscnModule.Action queryISCNByAddress!: (
arg0: string
) => ISCNRecordWithID[] | PromiseLike
- @Watch('currentAddress')
+ @bookApiModule.Getter('getSessionWallet') sessionWallet!: string
+
+
+ @Watch('sessionWallet')
onCurrentAddressChanged() {
this.refreshWorks()
}
@@ -145,8 +147,8 @@ export default class WorksIndexPageExtends extends Vue {
}
refreshWorks() {
- if (this.currentAddress) {
- this.queryISCNByAddress(this.currentAddress)
+ if (this.sessionWallet) {
+ this.queryISCNByAddress(this.sessionWallet)
}
}
@@ -167,7 +169,7 @@ export default class WorksIndexPageExtends extends Vue {
}
get portfolioURL(): string {
- return `${LIKER_LAND_URL}/${this.currentAddress}`
+ return `${LIKER_LAND_URL}/${this.sessionWallet}`
}
}
diff --git a/store/book-api.ts b/store/book-api.ts
index 302f7914..c898d535 100644
--- a/store/book-api.ts
+++ b/store/book-api.ts
@@ -36,9 +36,7 @@ export default class BookAPI extends VuexModule {
try {
const { data } = await axios.post(
API_POST_AUTHORIZE,
- {
- ...signature,
- },
+ signature,
)
const token = (data as any)?.token
if (!token) {