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

RSVP routed #26

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

RSVP routed #26

wants to merge 11 commits into from

Conversation

Tiffany-Zhu5303
Copy link
Contributor

RSVP page adds to table and reroutes back to homepage

@DinsmoreDesign
Copy link

Just as an FYI - This was my first chance to really dive into the code you all have been writing and I didn't realize you were using React Router, as I saw the window calls today, but not the<Link/> references. The reason you're seeing the white screen when navigating between some of the pages after you submit a form is because you're using window.location.replace(). While this definitely works, it forces a complete refresh of the page, which is what happens when the pages goes blank before it rerenders React. If you use the built in router push, instead, you shouldn't see that, as it will just replace the existing route with the new one, without the full page reload. Here's a generic example:

import { useHistory } from 'react-router-dom';

const componentName = () => {
  const history = useHistory();
  
  const handleRouteChange = () => history.push('/newPageRoute');
  
  return <button onClick={() => handleRouteChange()}>Change route</button>
}

export default componentName;

@@ -51,7 +50,11 @@ function ViewEvent() {
<div className="image-container">
<img src={placeholder} className="image"></img>
<br></br>
<button className="rsvp-button">
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

oh I see a merge conflict here - so just delete lines 55-57 (and the <<<<<<< HEAD line) and you should be good to go!

<select className="dropdown">

<select value={RSVP} onChange={(e) => setRSVP(e.target.value)} className="dropdown">
<option></option>
Copy link
Member

Choose a reason for hiding this comment

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

should there be a no in between these option tags?

try {
var res = await fetch(`http://localhost:3000/api/event/${event_id}/rsvp`, {
method: "POST",
//headers: { 'Content-Type': 'application/json' },
Copy link
Member

Choose a reason for hiding this comment

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

I guess we don't need this header so you can just delete this line!

event_id: parseInt(event_id) , name: ResponderName, rsvp: RSVP
}),
});
console.log(res)
Copy link
Member

Choose a reason for hiding this comment

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

I think we can get rid of this console.log()!

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

Successfully merging this pull request may close these issues.

5 participants