diff --git a/components/Dashboard.js b/components/Dashboard.js index 97f7378..28da50f 100644 --- a/components/Dashboard.js +++ b/components/Dashboard.js @@ -16,12 +16,12 @@ import { supabase } from "../utils/supabaseClient"; import { toast } from "react-toastify"; import { useRouter } from "next/router"; -export default function Account(props) { +export default function Dashboard(props) { const router = useRouter(); const [loading, setLoading] = useState(false); const [username, setUsername] = useState(props.profile.username); const [website, setWebsite] = useState(props.profile.website); - const [avatar_url, setAvatarUrl] = useState(null); + const [avatar_url, setAvatarUrl] = useState(props.profile.avatar_url); const [payment, setPayment] = useState(false); useEffect(() => { diff --git a/setupSupabaseSQL.sql b/setupSupabaseSQL.sql index 56b4d86..c8f8210 100644 --- a/setupSupabaseSQL.sql +++ b/setupSupabaseSQL.sql @@ -33,9 +33,9 @@ create policy "Avatar images are publicly accessible." on storage.objects for select using ( bucket_id = 'avatars' ); -create policy "Anyone can upload an avatar." +create policy "Any authenticated user can upload an avatar." on storage.objects for insert - with check ( bucket_id = 'avatars' ); + with check ( bucket_id = 'avatars' and auth.role() = 'authenticated' ); -- inserts a row into public.profiles create function public.handle_new_user()