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.
const fetchData = async () => { const { data, error } = await supabase .from('sneaker') .select() .eq('brand', props.model?.brand) .like('name', '%Yeezy%') filteredList1.value = data console.log(data) }
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?
.like('name', `%${props.model?.name}%`)