supabase
supabase copied to clipboard
How to use useAsyncData and Supabase in composable while preserving type prediction?
Hello everyone,
Using Supabase and Nuxt is smooth as butter thanks to this module. Thanks to all the teams for the wonderful work! 👍🏼
I am trying to implement a composable to manage my calls. So I started with the example from the NuxtSupabase documentation:
This works fine, and I can see the return type. Now I want to centralize some logic in a composable. Here is my solution:
And the associated composable useDatabase:
This all works fine, but I lose the Supabase client return type prediction. No matter how much I try different ways of doing things, I systematically lose type inference.
How to manage the Supabase client with useAsyncData in separate composable while benefiting from type prediction? Am I missing something?