forked from ttc/micro-service-api
-first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { sendError } from '../../utils/response.js';
|
||||
import { OTPVerifyService } from '../../services/otpverifyservice.js';
|
||||
import { GeneralService } from '../../share/generalservice.js';
|
||||
|
||||
export class OtpVerifyController {
|
||||
constructor() {
|
||||
this.otpVerifyService = new OTPVerifyService();
|
||||
this.generalService = new GeneralService();
|
||||
}
|
||||
|
||||
async onNavigate(req, res) {
|
||||
let idx = -1, result = [];
|
||||
try {
|
||||
const { email, otp } = req.body.request;
|
||||
result = await this.otpVerifyService.verifyOtp(email, otp);
|
||||
} catch (error) {
|
||||
idx = 1;
|
||||
this.generalService.devhint(1, 'otpverifycontroller.js', 'Jumpout', error.message);
|
||||
} finally {
|
||||
if (idx === 1) return sendError('เกิดข้อผิดพลาดในการตรวจสอบ OTP', 'OTP verification error');
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user