Trying to push through a prop to the .like filtering option in supabase function. Due to .like needing % in value, im not sure how to push the prop through. Please see below.
JavaScript
x
10
10
1
const fetchData = async () => {
2
const { data, error } = await supabase
3
.from('sneaker')
4
.select()
5
.eq('brand', props.model?.brand)
6
.like('name', '%Yeezy%')
7
filteredList1.value = data
8
console.log(data)
9
}
10
I would like to have props.model?.name instead of ‘%Yeezy%’. I have tried adding in the prop like stated but does not work. Much appreciated.
Advertisement
Answer
Have you tried concatenating the string?
JavaScript
1
2
1
.like('name', `%${props.model?.name}%`)
2