Supabase Fetch Count Returns Null
I'm using svelteKit (after the reactor) and I'm trying to get a count of my total entries in my table. here is the code:
export default async function load(){
let { data: count, error } = await supabase
.from('smsspam')
// My table is named smsspam
.select('*', { count: 'planned', head: true })
// selecting all entries in the table and counting them, using head because I only want the count.
//the results should look like:
// {"count": 3,"status": 200, "statusText": "OK" } but returns null.
console.log("Total Rows",count)
if (error) {
console.log(error.message);
}
return {
props:{count}
};
}