fix command 08

This commit is contained in:
Bright 2024-12-04 15:46:20 +07:00
parent 04c200027f
commit f7653aa4cf

View file

@ -2240,8 +2240,8 @@ export class CommandController extends Controller {
firstName: profile.firstName,
lastName: profile.lastName,
});
// กรณี Keycloak ไม่ถูกลบ ให้ลบซ้ำอีกรอบแล้วสร้างใหม่
if (profile.keycloak != null && userKeycloakId && userKeycloakId.error === "User exists with same username") {
// กรณี Keycloak ไม่ถูกลบ ให้ลบซ้ำอีกรอบแล้วสร้างใหม่ และหากยังไม่สามารถลบได้ให้แสดง Error
if (profile.keycloak != null && userKeycloakId && userKeycloakId.errorMessage === "User exists with same username") {
const delUserKeycloak = await deleteUser(profile.keycloak);
if(delUserKeycloak) {
userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
@ -2249,6 +2249,9 @@ export class CommandController extends Controller {
lastName: profile.lastName,
});
}
else {
throw new HttpError(HttpStatus.BAD_REQUEST, "พบข้อผิดพลาด ไม่สามารถจัดการผู้ใช้งานได้");
}
}
const list = await getRoles();
let result = false;