Skip to content

Commit

Permalink
Merge pull request #7539 from newraina/recurring-payment-link
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwao authored Oct 9, 2023
2 parents 7124d6b + d6f56f1 commit 6f48e0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/transfer/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</NeoDropdownItem>

<NeoDropdownItem
v-clipboard:copy="generateRecurringPaymentLink()"
v-clipboard:copy="recurringPaymentLink"
class="no-wrap"
data-testid="transfer-dropdown-recurring"
@click="toast($t('toast.urlCopy'))">
Expand Down Expand Up @@ -833,13 +833,13 @@ const onTxError = async (dispatchError: DispatchError): Promise<void> => {
isLoading.value = false
}
const generateRecurringPaymentLink = () => {
const recurringPaymentLink = computed(() => {
const addressList = targetAddresses.value
.filter((item) => isAddress(item.address) && !item.isInvalid)
.map((item) => item.address)
return generatePaymentLink(addressList)
}
})
const generatePaymentLink = (addressList: string[]): string => {
const url = new URL(`${location.origin}${location.pathname}`)
Expand Down
10 changes: 9 additions & 1 deletion plugins/vueClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ export default defineNuxtPlugin((nuxtApp) => {

nuxtApp.vueApp.directive('clipboard', {
beforeMount(el, { value, arg }) {
el.dataset._clipboard_value = value
useEventListener(el, 'click', () => {
switch (arg) {
case 'copy':
copy(value)
copy(el.dataset._clipboard_value)
break
}
})
},
updated(el, { value, arg }) {
switch (arg) {
case 'copy':
el.dataset._clipboard_value = value
break
}
},
})

return {
Expand Down

0 comments on commit 6f48e0a

Please sign in to comment.