Update SQL query
This commit is contained in:
parent
b7a1815c62
commit
fa95e7496e
1 changed files with 6 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import { useSession } from "@ui/contexts/SessionContext";
|
|||
import { api } from "@ui/lib/api";
|
||||
import { toast } from "@ui/ui-library/toast/toast-queue";
|
||||
import { RemoveNullFromObject } from "@ui/types/removeNull";
|
||||
import { useUser } from "@ui/providers/UserStoreProvider";
|
||||
|
||||
type Tablo = Database["public"]["Tables"]["tablos"];
|
||||
|
||||
|
|
@ -17,10 +18,14 @@ type UserTablo = RemoveNullFromObject<
|
|||
|
||||
// Fetch all tablos
|
||||
export const useTablosList = () => {
|
||||
const user = useUser();
|
||||
return useQuery({
|
||||
queryKey: ["tablos"],
|
||||
queryFn: async () => {
|
||||
const { data, error } = await supabase.from("user_tablos").select("*");
|
||||
const { data, error } = await supabase
|
||||
.from("user_tablos")
|
||||
.select("*")
|
||||
.eq("user_id", user.id);
|
||||
if (error) throw error;
|
||||
const tablos = data as UserTablo[];
|
||||
return tablos;
|
||||
|
|
|
|||
Loading…
Reference in a new issue