Here is how I wrote my supabase query with nuxt3:
const client = useSupabaseClient()
const { data: expenses } = await useAsyncData('count', async () => {
const { data, count } = await client.from<Expenses>('expenses').select('amount, currency', { count: 'exact' })
return { data, count }
})
console.log('useAsyncData :', expenses.value)
This is the outcome of my query:
https://i.sstatic.net/l8eDX.png
I am looking to calculate the sum of amounts and group them by currency
The desired result in mind:
const result = { 0: 33800, 1: 10 }