Skip to content

Commit

Permalink
Merge pull request #71 from Yash-Ainapure/patch1
Browse files Browse the repository at this point in the history
Fix: Renaming "/submit" routes fixes:- #68
  • Loading branch information
Kritika30032002 authored Dec 7, 2023
2 parents 0e3133b + bd81ad6 commit 70085f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ app.get("/secrets", function (req, res) {
});
});

app.get("/submit", function (req, res) {
app.get("/submit-secret-form", function (req, res) {
if (req.isAuthenticated()) {
res.render("submit");
res.render("secret-form");
} else {
res.redirect("/login");
}
});

app.post("/submit", function (req, res) {
app.post("/submit-secret-form", function (req, res) {
const submittedSecret = req.body.secret;
User.findById(req.user.id, function (err, foundUser) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion views/submit.ejs → views/secret-form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h1 class="display-3">Secrets</h1>
<p class="secret-text">Don't keep your secrets, share them anonymously!</p>

<form action="/submit" method="POST">
<form action="/submit-secret-form" method="POST">

<div class="form-group">
<input type="text" class="form-control text-center" name="secret" placeholder="What's your secret?">
Expand Down
2 changes: 1 addition & 1 deletion views/secrets.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<hr>
<div class="d-flex justify-content-center">
<a class="btn btn-light btn-lg col-2 mx-1" href="/logout" role="button">Log Out</a>
<a class="btn btn-dark btn-lg col-2 mx-1" href="/submit" role="button">Submit a Secret</a>
<a class="btn btn-dark btn-lg col-2 mx-1" href="/submit-secret-form" role="button">Submit a Secret</a>
</div>
</div>
</div>
Expand Down

0 comments on commit 70085f2

Please sign in to comment.