Files
micro-service-api/exthernal-login-api/src/controllers/registercontroller.js

27 lines
904 B
JavaScript
Raw Normal View History

2025-11-11 12:36:06 +07:00
import { RegisterService } from '../services/registerservice.js';
import { sendError } from '../utils/response.js';
import { GeneralService } from '../share/generalservice.js';
export class RegisterController {
constructor() {
this.registerService = new RegisterService();
this.generalService = new GeneralService();
}
async onNavigate(req, res) {
let idx = -1, result = [];
try {
const { organization, request } = req.body;
const { email, fname, lname, password } = request;
result = await this.registerService.requestRegistration(organization, email, fname, lname, password);
} catch (error) {
idx = 1;
this.generalService.devhint(1, 'registercontroller.js', 'Jumpout', error.message);
result = error; // จะถูก Global Handler จัด format
} finally {
if (idx === 1) return result;
return result;
}
}
}