Skip to content

Commit ee19c27

Browse files
authored
Merge pull request #27 from ShubhaMahobia/shubham_dev
Refactor fetchDoctorDetails function in authenticationController.js
2 parents 6dd51fd + 7824b1f commit ee19c27

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

controller/authenticationController.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,22 @@ exports.fetchUserDetails = async (req, res) => {
164164
//Login Fuction for fetching user Doctor details
165165
exports.fetchDoctorDetails = async (req, res) => {
166166
try {
167-
const email = req.body.email;
168-
if (email == null) {
167+
const docid = req.body.id;
168+
if (docid == null) {
169169
return res
170170
.status(400)
171171
.json({ success: false, message: "Please provide an email" });
172172
} else {
173-
const user = await userDoctor.findOne({ Email: email });
174-
if (!user) {
173+
const doctor = await userDoctor.findOne({ firebaseUserId: docid });
174+
if (!doctor) {
175175
return res.status(401).json({
176176
success: false,
177177
message: "Authentication failed! Email not found.",
178178
});
179179
} else {
180180
return res
181181
.status(401)
182-
.json({ success: true, data: user, message: "User success" });
182+
.json({ success: true, data: doctor, message: "User success" });
183183
}
184184
}
185185
} catch (err) {

0 commit comments

Comments
 (0)