Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
eeeae5181a
commit
002f4d00f0
@@ -105,8 +105,11 @@ function ClassesTab() {
|
||||
const { data: teachers } = useQuery({
|
||||
queryKey: ["teachers"],
|
||||
queryFn: async () => {
|
||||
const { data } = await supabase.from("user_roles").select("user_id, profiles(id, full_name, email)").eq("role", "teacher");
|
||||
return (data ?? []).map((d) => d.profiles as { id: string; full_name: string; email: string }).filter(Boolean);
|
||||
const { data: r } = await supabase.from("user_roles").select("user_id").eq("role", "teacher");
|
||||
const ids = (r ?? []).map((x) => x.user_id);
|
||||
if (ids.length === 0) return [];
|
||||
const { data } = await supabase.from("profiles").select("id, full_name, email").in("id", ids);
|
||||
return data ?? [];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user