Skip to content

Commit

Permalink
🐛 Fix empty link table for custom affiliation link (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt authored Oct 29, 2024
1 parent 137d356 commit 6b83c4e
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions pages/affiliation-link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<UInput
v-model="customDestinationURLInput"
class="font-mono"
placeholder="https://books.liker.land"
placeholder="https://liker.land/store?tag=blockchain"
name="custom_destination_url"
/>
</UFormGroup>
Expand Down Expand Up @@ -583,22 +583,24 @@ const productTableRows = computed(() => {
})
const linkTableColumns = computed(() => {
const cols = [
{
const cols: { key: string, label: string, sortable?: boolean }[] = []
if (!isUsingCustomDestination.value) {
cols.push({
key: 'productId',
label: 'Product',
sortable: true
},
{
key: 'selectedEditionLabel',
label: 'Edition'
},
{
key: 'channelId',
label: 'Channel',
sortable: true
}
]
})
}
cols.push({
key: 'channelId',
label: 'Channel',
sortable: true
})
if (!isSharingMode.value) {
cols.push({
Expand Down Expand Up @@ -633,7 +635,11 @@ const linkTableRows = computed(() => {
const rows: AffiliationLink[] = []
const channels = [...new Map([...customChannels.value, ...AFFILIATION_CHANNELS].map(c => [c.id, c])).values()]
productDataList.value?.forEach(({ id, data }) => {
const items = isUsingCustomDestination.value
? [{ id: 'custom', data: { name: 'Custom' } }]
: productDataList.value || []
items.forEach(({ id, data }) => {
const isCollection = id.startsWith('col_')
channels.forEach((channel) => {
Expand Down Expand Up @@ -661,7 +667,7 @@ const linkTableRows = computed(() => {
productName: data.name?.zh || data.name?.en || data.name,
isCollection,
selectedEditionIndex: priceIndex,
selectedEditionLabel: productEditionOptionsMap.value?.[id][priceIndex]?.label || '',
selectedEditionLabel: productEditionOptionsMap.value?.[id]?.[priceIndex]?.label || '',
channelId: channel.id,
channelName: channel.name,
utmCampaign,
Expand Down

0 comments on commit 6b83c4e

Please sign in to comment.