How can I get a channel list with Filter on multiple conditions? i using '@amityco/js-sdk'

Hi everyone,

for example, I have 3 channels:

  • channel 1 with tags: ‘ios’
  • channel 2 with tags: ‘android’
  • channel 3 with tags: ‘window’

now i want to get a list with channels that having tag ‘ios’ and ‘android’, so the output should be [channel 1, channel 2]

i have tried this:
const liveCollection = ChannelRepository.queryChannels({
types: [ChannelType.Community],
tags: [‘ios’, ‘android’],
});

but didnt work. Are there any ways that i can filter on multiple conditions?
btw i using ‘@amityco/js-sdk’

Hi @huykaiser273 may I confirm what is your channel type? is it community?

We did check your code and it should work, pls see here’s the sample code:

export const getChannels = async () => {
    const liveCollection = ChannelRepository.queryChannels({
        types: [ChannelType.Community],
        filter: ChannelFilter.Member,
        tags: ['ios', 'android'],
        excludeTags: ['deleted'],
        sortBy: ChannelSortingMethod.FirstCreated
    });

    liveCollection.on('dataUpdated', models => {
        console.log("checking get channels " + JSON.stringify(models))
    });
}
1 Like

oh i have tried again and it works, Many tks

1 Like