Skip to content

Bug fixes #31

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

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4c3c18d
Update README.md
williamlines Nov 28, 2022
747e826
Merge pull request #1 from williamlines/williamlines-patch-1
williamlines Nov 28, 2022
fa6072c
Understanding the code
Nov 30, 2022
3074b52
fixed broken tests
williamlines Dec 1, 2022
18a29cc
added the rest of the files missed by first commit
williamlines Dec 1, 2022
98b5d13
fixed spelling error
williamlines Dec 1, 2022
de6f9a2
Home page established and route to /home created
Dec 1, 2022
a2f1908
Add tests for date and implement method
kwatts949 Dec 1, 2022
6c24d68
added route to new post form and mostly built the functionality
williamlines Dec 1, 2022
9a53af5
fixed post request
williamlines Dec 1, 2022
cd7d956
driver switch
robin277t Dec 1, 2022
5f1c9c5
now updates token (maybe?)
tomfyfe85 Dec 1, 2022
c460972
cypress homepage test
tbuller Dec 1, 2022
061ba58
switch driver
kwatts949 Dec 1, 2022
32a458a
Merge pull request #2 from williamlines/feature_newest_post
kwatts949 Dec 1, 2022
ccfeafc
can post to feed with an updated token (NewPostForm.js). NewPostForm.…
tomfyfe85 Dec 1, 2022
879419c
Homepage complete with testing in end to end
tbuller Dec 2, 2022
8a5715d
started test
williamlines Dec 2, 2022
f0a4e15
fixed component test
williamlines Dec 2, 2022
181eb90
feature complete and tested
robin277t Dec 2, 2022
be98534
making_a_post_on_a_page.cy.js completed
tomfyfe85 Dec 2, 2022
0e14dce
Merge pull request #4 from williamlines/post-have-users-2
robin277t Dec 2, 2022
5e01bf6
merge conflict
williamlines Dec 2, 2022
78409f4
Merge pull request #5 from williamlines/expl
williamlines Dec 2, 2022
dd7ed5e
solve conflicts
tbuller Dec 2, 2022
de5593d
Merge branch 'main' into HB1
robin277t Dec 2, 2022
58c4cd6
Merge pull request #6 from williamlines/HB1
H6enryB Dec 2, 2022
7c72007
updated model
williamlines Dec 2, 2022
7c5f224
home fix
tbuller Dec 2, 2022
70538ff
Merge pull request #7 from williamlines/comments
tomfyfe85 Dec 2, 2022
1a3d2f8
.
tomfyfe85 Dec 2, 2022
a296312
merge fix
tomfyfe85 Dec 2, 2022
b9a671c
comments2 commit 1
tbuller Dec 2, 2022
86f6709
todo like button in Feed.js (see comment in file)
tomfyfe85 Dec 2, 2022
88e958a
continued work on comments function
robin277t Dec 5, 2022
0fb7298
likes are unique
tomfyfe85 Dec 5, 2022
e255f11
built post request on like method in Feed.js
tomfyfe85 Dec 5, 2022
9375a40
built routing for post request to /likes. started building controller…
tomfyfe85 Dec 5, 2022
e23bc93
collected relevant data from post request to /likes
tomfyfe85 Dec 5, 2022
6b2d5e3
comments schema works
tbuller Dec 5, 2022
de97692
likers added to post document
tomfyfe85 Dec 5, 2022
49fed2d
reloads the page on like, and displays likes
tomfyfe85 Dec 5, 2022
26a8345
comments working but navigate bug and not displaued yet
robin277t Dec 5, 2022
5ba5c04
comments feature mostly working
robin277t Dec 5, 2022
d6bdf72
Merge pull request #8 from williamlines/feature-likes
robin277t Dec 5, 2022
28af3dd
Merge branch 'main' into comments2
tbuller Dec 5, 2022
d8df1b5
Merge pull request #9 from williamlines/comments2
tbuller Dec 5, 2022
7ac4607
chevron and formatting fixes
tbuller Dec 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed post request
williamlines committed Dec 1, 2022
commit 9a53af5b5bcf1ae7b126579780518d01421dd1bf
29 changes: 15 additions & 14 deletions frontend/src/components/post/NewPostForm.js
Original file line number Diff line number Diff line change
@@ -7,21 +7,22 @@ const NewPostForm = ({ navigate }) => {
const postSubmit = async (event) => {
event.preventDefault();

fetch( '/posts', {
method: 'post',
console.log(content);

fetch("/posts", {
method: "post",
headers: {
'Authorization': `Bearer ${token}`
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
// MUST FIX POST REQUEST
body: JSON.stringify({ message: content })
})
.then(response => {
if(response.status === 201) {
navigate('/posts')
} else {
navigate('/login')
}
})
body: JSON.stringify({ message: content }),
}).then((response) => {
if (response.status === 201) {
navigate("/posts");
} else {
navigate("/login");
}
});
};

const handleContentChange = (event) => {
@@ -37,7 +38,7 @@ const NewPostForm = ({ navigate }) => {
value={content}
onChange={handleContentChange}
/>
<input id="submit" type="submit" value="Create Post" />
<input id="submit" type="submit" value="Submit" />
</form>
);
};
67 changes: 38 additions & 29 deletions frontend/src/components/user/SignUpForm.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,54 @@
import React, { useState } from 'react';
import React, { useState } from "react";

const SignUpForm = ({ navigate }) => {

const [email, setEmail] = useState("");
const [password, setPassword] = useState("");

const handleSubmit = async (event) => {
event.preventDefault();

fetch( '/users', {
method: 'post',
fetch("/users", {
method: "post",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({ email: email, password: password })
})
.then(response => {
if(response.status === 201) {
navigate('/login')
} else {
navigate('/signup')
}
})
}
body: JSON.stringify({ email: email, password: password }),
}).then((response) => {
if (response.status === 201) {
navigate("/login");
} else {
navigate("/signup");
}
});
};

const handleEmailChange = (event) => {
setEmail(event.target.value)
}
setEmail(event.target.value);
};

const handlePasswordChange = (event) => {
setPassword(event.target.value)
}


return (
<form onSubmit={handleSubmit}>
<input placeholder="Email" id="email" type='text' value={ email } onChange={handleEmailChange} />
<input placeholder="Password" id="password" type='password' value={ password } onChange={handlePasswordChange} />
<input id='submit' type="submit" value="Submit" />
</form>
);
}
setPassword(event.target.value);
};

return (
<form onSubmit={handleSubmit}>
<input
placeholder="Email"
id="email"
type="text"
value={email}
onChange={handleEmailChange}
/>
<input
placeholder="Password"
id="password"
type="password"
value={password}
onChange={handlePasswordChange}
/>
<input id="submit" type="submit" value="Submit" />
</form>
);
};

export default SignUpForm;