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

Update Manager.jsx #216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion Video 130/passop-mongo/src/components/Manager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ const Manager = () => {
if (form.site.length > 3 && form.username.length > 3 && form.password.length > 3) {

// If any such id exists in the db, delete it
await fetch("http://localhost:3000/", { method: "DELETE", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id: form.id }) })
if(form.id){ //if this statement is not there then it will delete one entry anyways, have to resist it that way
await fetch("http://localhost:3000/", { method: "DELETE", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id: form.id }) })
}

setPasswordArray([...passwordArray, { ...form, id: uuidv4() }])
await fetch("http://localhost:3000/", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...form, id: uuidv4() }) })
Expand Down