Skip to content

prompt generation of backend.... post and get giving error 404 but it…#39

Open
harrywu23 wants to merge 1 commit intomainfrom
feat/sponsors-backend
Open

prompt generation of backend.... post and get giving error 404 but it…#39
harrywu23 wants to merge 1 commit intomainfrom
feat/sponsors-backend

Conversation

@harrywu23
Copy link
Copy Markdown
Contributor

… should be good once its fixed.

}, []);

if (!sponsors) {
if (sponsors.length === 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length = 0 isn't preferable (if there's no sponsors then we're stuck in an infinite loading state!)

should use !sponsors like before (and usestate defaults to null like previously)


useEffect(() => {
Promise.resolve(sponsorsJsonData as SponsorsData)
fetch("http://localhost:3000/api/sponsors")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use axios for this, also consider adding a sponsorsApi.ts file to handle basic boilerplate (acts as a quick way to see/update the routes if the endpoint urls ever change)

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

Successfully merging this pull request may close these issues.

2 participants