summaryrefslogtreecommitdiff
path: root/server/controllers/message.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/message.js')
-rw-r--r--server/controllers/message.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/server/controllers/message.js b/server/controllers/message.js
index 8061c7a..120cb20 100644
--- a/server/controllers/message.js
+++ b/server/controllers/message.js
@@ -1,40 +1,40 @@
-import generateOTP from '../utils/otp';
-import sendSMS from '../services/twilio';
+import generateOTP from "../utils/otp.js";
+import sendSMS from "../services/twilio.js";
const sendOTP = async (req, res) => {
- const {mobile} = req.body;
+ const { mobile } = req.body;
try {
const otp = generateOTP();
const message = `Your OTP for Aadhaar verification is : ${otp}`;
sendSMS(mobile, message);
- res.status(200).json({message: 'OTP sent successfully', otpCode: otp});
+ res.status(200).json({ message: "OTP sent successfully", otpCode: otp });
} catch (error) {
- res.status(404).json({message: error});
+ res.status(404).json({ message: error });
}
};
const sendMessage = async (req, res) => {
- const {mobile, id} = req.body;
+ const { mobile, id } = req.body;
try {
const message = `Your request for aadhaar card has been successfully submitted. Please use the id: ${id} for future reference.`;
sendSMS(mobile, message);
- res.status(200).json({message: 'Message sent successfully'});
+ res.status(200).json({ message: "Message sent successfully" });
} catch (error) {
- res.status(404).json({message: error});
+ res.status(404).json({ message: error });
}
};
const sendMessages = async (req, res) => {
- const {mobile, message} = req.body;
+ const { mobile, message } = req.body;
try {
sendSMS(mobile, message);
- res.status(200).json({message: 'Message sent successfully'});
+ res.status(200).json({ message: "Message sent successfully" });
} catch (error) {
- res.status(404).json({message: error});
+ res.status(404).json({ message: error });
}
};
-export default {sendOTP, sendMessage, sendMessages};
+export default { sendOTP, sendMessage, sendMessages };