Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
samwpr opened this issue Sep 13, 2022 · 9 comments
Open

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

samwpr opened this issue Sep 13, 2022 · 9 comments

Comments

@samwpr
Copy link

samwpr commented Sep 13, 2022

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
Copy link

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

@Teegreat
Copy link

Teegreat commented Nov 6, 2022

I also have the same problem

@bond0887
Copy link

bond0887 commented Nov 6, 2022

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
Copy link

Teegreat commented Nov 6, 2022

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

@Teegreat
Copy link

Teegreat commented Nov 6, 2022

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
Copy link

bond0887 commented Nov 6, 2022

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
Copy link

Teegreat commented Nov 6, 2022

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
Copy link

Teegreat commented Nov 6, 2022

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants