dm: 전화번호 포맷 & 비번 변경

This commit is contained in:
2026-07-08 10:32:33 +09:00
parent fb638752eb
commit 1076120516
+29 -1
View File
@@ -43,6 +43,34 @@ export const sdmInfoFormSchema = z.object({
export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>;
const formatTelno = (telno?: string | null) => {
const digits = (telno ?? '').replace(/\D/g, '');
if (!digits) {
return '';
}
if (digits.startsWith('02')) {
if (digits.length === 9) {
return digits.replace(/(02)(\d{3})(\d{4})/, '$1-$2-$3');
}
if (digits.length === 10) {
return digits.replace(/(02)(\d{4})(\d{4})/, '$1-$2-$3');
}
}
if (digits.length === 10) {
return digits.replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3');
}
if (digits.length === 11) {
return digits.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
}
return telno ?? '';
};
// 수요처 정보
export type DemandCompBizType = {
@@ -694,7 +722,7 @@ export const SdmReducer = (set: any): SdmActions => {
dmdInfoId: res.dmdInfoId,
zip: res.zip || '',
daddr: res.daddr,
telno: res.telno.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'),
telno: formatTelno(res.telno),
rgtr: res.rgtr,
ctpvCd: res.ctpvCd,
sggCd: res.sggCd,