adrianhajdin / project_professional_portfolio

This is a code repository for the corresponding YouTube video. In this tutorial we are going to build and deploy a real time chat application. Covered topics: React.js, SCSS, Framer Motion, Sanity
https://jsmastery.pro
2.07k stars 496 forks source link

Images in About Section doesn't show after connecting to Sanity. #40

Open samwpr opened 2 years ago

samwpr commented 2 years ago

Hi everyone, could I please ask for assistance with the following issue?

I am at this section of the youtube tutorial.

Screenshot 2022-09-13 at 4 42 23 PM

Everything was working perfectly, but once I connected to Sanity, this website section doesn't show.

Screenshot 2022-09-13 at 4 43 44 PM

I have tried the following but nothing seems to work:

  1. Checking that in my client.js I use 'projectId' and not 'projectID'
  2. Instead of using 'process.env.REACT_APP_SANITY_PROJECT_ID' use the actual project ID. When I use 'process.env.REACT_APP_SANITY_PROJECT_ID' it shows a blank page. When I use the actual project ID I can see the website but the about us section is missing.

While following the tutorial the only thing I did that differed from the video was at 1:48:20 of the video where after he created the .env file he reloaded the application via ctrl c I am on a mac so in my terminal I used man kill instead.

Please find my code below: .env

Screenshot 2022-09-13 at 4 39 41 PM

client.js

Screenshot 2022-09-13 at 4 40 54 PM

About.jsx

Screenshot 2022-09-13 at 4 53 54 PM
M-TorresDeveloper commented 2 years ago

same here... seems like many things aren't working well like google cloud integration as well...

Teegreat commented 2 years ago

I also have the same problem

bond0887 commented 2 years ago

using async await instead of .then worked for me.

const fetchAbouts = async () => { const query = '*[_type == "abouts"]'; setAbouts(await client.fetch(query)); }

useEffect(() => { fetchAbouts(); }, []);

This code worked for me but I don't know the logic behind this, if anyone can explain it would be great. TIA

Teegreat commented 2 years ago

Didn't work for me. Let me see your full code pls

Teegreat commented 2 years ago

using async await instead of .then worked for me.

const fetchAbouts = async () => { const query = '*[_type == "abouts"]'; setAbouts(await client.fetch(query)); }

useEffect(() => { fetchAbouts(); }, []);

This code worked for me but I don't know the logic behind this, if anyone can explain it would be great. TIA

Full code pls

bond0887 commented 2 years ago

using async await instead of .then worked for me. const fetchAbouts = async () => { const query = '*[_type == "abouts"]'; setAbouts(await client.fetch(query)); } useEffect(() => { fetchAbouts(); }, []); This code worked for me but I don't know the logic behind this, if anyone can explain it would be great. TIA

Full code pls

https://github.com/bond0887/portfolio-frontend

Teegreat commented 2 years ago

using async await instead of .then worked for me. const fetchAbouts = async () => { const query = '*[_type == "abouts"]'; setAbouts(await client.fetch(query)); } useEffect(() => { fetchAbouts(); }, []); This code worked for me but I don't know the logic behind this, if anyone can explain it would be great. TIA

Full code pls

https://github.com/bond0887/portfolio-frontend

Thanks but still stuck

Teegreat commented 2 years ago

Finally found the solution.

Go to Sanity Manage Project => Add CORS ORIGIN => Paste this: http://localhost:* => Select "allow credentials" => Save and you are good to go

justmarvee102 commented 5 months ago

Finally found the solution.

Go to Sanity Manage Project => Add CORS ORIGIN => Paste this: http://localhost:* => Select "allow credentials" => Save and you are good to go

Did this work for anyone?