How should i display user photo?

Hi, just started using Supabase. When the user uploads a photo, i retrieve it's public URL and add that to the avatar_url property of 'profiles' table row. And then at the account page i display it using that url as the img source. But i'm getting a GET 400 error. Am i doing it the wrong way? Should i create an object url like ?
const { data, error } = await supabase.storage
        .from('avatars')
        .download(path)
      if (error) {
        throw error
      }
      const url = URL.createObjectURL(data)
Was this page helpful?