Skip to content

Commit

Permalink
🐛 Don't change connectedWallet object if not updated
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jan 6, 2025
1 parent c1139a4 commit 0e89625
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions pages/nft-book-store/collection/status/[collectionId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ const moderatorWalletInput = ref('')
const notificationEmailInput = ref('')
const isStripeConnectChecked = ref(false)
const stripeConnectWallet = ref('')
const connectedWallets = ref<any>({})
const useLikerLandPurchaseLink = ref(true)
const shouldShowAdvanceSettings = ref<boolean>(false)
const shouldDisableStripeConnectSetting = ref(false)
Expand Down Expand Up @@ -764,6 +765,7 @@ onMounted(async () => {
moderatorWallets.value = classModeratorWallets
notificationEmails.value = classNotificationEmails
isStripeConnectChecked.value = !!(classConnectedWallets && Object.keys(classConnectedWallets).length)
connectedWallets.value = classConnectedWallets
const classStripeWallet = classConnectedWallets && Object.keys(classConnectedWallets)[0]
if (classStripeWallet) {
Expand Down Expand Up @@ -841,12 +843,13 @@ function addNotificationEmail () {
}
async function handleSaveStripeConnectWallet (wallet: any) {
connectedWallets.value = {
[wallet]: 100
}
stripeConnectWallet.value = wallet
try {
await updateNFTBookCollectionById(collectionId.value as string, {
connectedWallets: {
[stripeConnectWallet.value]: 100
}
connectedWallets: connectedWallets.value
})
} catch (err) {
const errorData = (err as any).data || err
Expand All @@ -866,15 +869,13 @@ async function updateSettings () {
}
isLoading.value = true
const connectedWallets = (isStripeConnectChecked.value && stripeConnectWallet.value)
? {
[stripeConnectWallet.value]: 100
}
const newConnectedWallets = (isStripeConnectChecked.value && stripeConnectWallet.value)
? connectedWallets.value
: null
await updateNFTBookCollectionById(collectionId.value as string, {
moderatorWallets,
notificationEmails,
connectedWallets
connectedWallets: newConnectedWallets
})
router.push({
name: 'nft-book-store-collection'
Expand Down
17 changes: 9 additions & 8 deletions pages/nft-book-store/status/[classId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ const moderatorWalletInput = ref('')
const notificationEmailInput = ref('')
const isStripeConnectChecked = ref(false)
const stripeConnectWallet = ref('')
const connectedWallets = ref<any>({})
const mustClaimToView = ref(true)
const hideDownload = ref(false)
const enableCustomMessagePage = ref(true)
Expand Down Expand Up @@ -1061,6 +1062,7 @@ onMounted(async () => {
moderatorWallets.value = classModeratorWallets
notificationEmails.value = classNotificationEmails
isStripeConnectChecked.value = !!(classConnectedWallets && Object.keys(classConnectedWallets).length)
connectedWallets.value = classConnectedWallets
const classStripeWallet = classConnectedWallets && Object.keys(classConnectedWallets)[0]
if (classStripeWallet) {
Expand Down Expand Up @@ -1182,12 +1184,13 @@ function addNotificationEmail () {
}
async function handleSaveStripeConnectWallet (wallet: any) {
connectedWallets.value = {
[wallet]: 100
}
stripeConnectWallet.value = wallet
try {
await updateBookListingSetting(classId.value as string, {
connectedWallets: {
[stripeConnectWallet.value]: 100
}
connectedWallets: connectedWallets.value
})
} catch (err) {
const errorData = (err as any).data || err
Expand All @@ -1207,15 +1210,13 @@ async function updateSettings () {
}
isLoading.value = true
const connectedWallets = (isStripeConnectChecked.value && stripeConnectWallet.value)
? {
[stripeConnectWallet.value]: 100
}
const newConnectedWallets = (isStripeConnectChecked.value && stripeConnectWallet.value)
? connectedWallets.value
: null
await updateBookListingSetting(classId.value as string, {
moderatorWallets,
notificationEmails,
connectedWallets,
connectedWallets: newConnectedWallets,
hideDownload,
mustClaimToView,
tableOfContents,
Expand Down

0 comments on commit 0e89625

Please sign in to comment.