Skip to content

Commit

Permalink
🎨 Handle default info when user data is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Feb 16, 2024
1 parent 1f52588 commit 4474a88
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1140,25 +1140,19 @@ export default class IscnRegisterForm extends Vue {
}
async fetchUserInfoByAddress(address: any) {
let userData: any = null;
try {
const { data } = await this.$axios.get(getUserInfoMinByAddress(address))
return {
name: data?.displayName || address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: data?.user || '',
authorDescription: data?.description || 'Publisher',
}
({ data: userData } = await this.$axios.get(getUserInfoMinByAddress(address)))
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
return {
name: address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: '',
authorDescription: 'Publisher',
}
}
return {
name: userData?.displayName || address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: userData?.user || '',
authorDescription: userData?.description || 'Publisher',
}
}
Expand Down

0 comments on commit 4474a88

Please sign in to comment.