Skip to content

Commit f601d7c

Browse files
authored
Merge pull request #2 from codefest-iit-bhu/ca-bug
fix: ca controller bug
2 parents e3a1eb6 + d7472b0 commit f601d7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

controllers/ca.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ export const updateRequest = async (req, res, next) => {
5858
);
5959
}
6060
if (status) {
61-
request.status = status;
6261
if (req.user.role === "admin" && status === "approved") {
6362
await User.findByIdAndUpdate(request.user, { role: "ca" });
6463
}
6564

6665
if (req.user.role === "admin" && status !== "approved" && request.status === "approved") {
6766
await User.findByIdAndUpdate(request.user, { role: "user" });
6867
}
68+
request.status = status;
6969
}
7070

7171
if (req.user.role !== "admin") {

0 commit comments

Comments
 (0)