Skip to content

Commit ed81931

Browse files
Refactored isSignedin controller
1 parent 10c242d commit ed81931

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ exports.signin = async (req, res) => {
6565
// Generating token using user email
6666
const token = jsonWebToken.sign({ email: email }, process.env.SECRET);
6767
// Setting cookie with the token that will expire after one day
68-
res.cookie("token_id", token, { expire: new Date() + 1 });
68+
res.cookie("token", token, { expire: new Date() + 1 });
6969

7070
return res.status(202).json({ _id: _id, name: name, email: email, bio: bio });
7171
}
@@ -85,6 +85,6 @@ exports.isSignedin = expressjwt({
8585
// Signout user
8686
exports.signout = async (req, res) => {
8787
// Clearing cookie
88-
res.clearCookie("token_id");
88+
res.clearCookie("token");
8989
return res.status(205).json({ message: "User signed out" });
9090
}

0 commit comments

Comments
 (0)