--- app/(protected)/(basic)/admins/_components/admin-member-form-fields.tsx
+++ app/(protected)/(basic)/admins/_components/admin-member-form-fields.tsx
... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 |
ADMIN_ROLE_OPTIONS, |
| 12 | 12 |
} from '@/lib/domain/admin-member'; |
| 13 | 13 |
import type { AdminMemberFormErrors } from '@/lib/domain/admin-member-form';
|
| 14 |
+import { MOBILE_PHONE_PREFIXES } from '@/lib/domain/phone-number';
|
|
| 14 | 15 |
import styles from './admin-member-modal.module.scss'; |
| 15 | 16 |
|
| 16 | 17 |
interface AdminMemberFormFieldsProps {
|
... | ... | @@ -78,6 +79,8 @@ |
| 78 | 79 |
</FoxFormLabel> |
| 79 | 80 |
<FoxPhoneNumber |
| 80 | 81 |
type="unit" |
| 82 |
+ // 넘기지 않으면 앞자리 셀렉트가 빈 목록이라 아무것도 고를 수 없다(상수 주석 참조). |
|
| 83 |
+ prefixOptions={[...MOBILE_PHONE_PREFIXES]}
|
|
| 81 | 84 |
value={phoneNumber}
|
| 82 | 85 |
onChange={onPhoneNumberChange}
|
| 83 | 86 |
message={errors.phoneNumber}
|
--- lib/domain/phone-number.ts
+++ lib/domain/phone-number.ts
... | ... | @@ -57,3 +57,19 @@ |
| 57 | 57 |
|
| 58 | 58 |
return groups === null ? trimmed : groups.join('-');
|
| 59 | 59 |
} |
| 60 |
+ |
|
| 61 |
+/** |
|
| 62 |
+ * 휴대전화 앞자리 목록 — `FoxPhoneNumber`의 앞자리 셀렉트에 넘긴다. |
|
| 63 |
+ * |
|
| 64 |
+ * **넘기지 않으면 그 셀렉트에 고를 것이 하나도 없다**(@fox의 기본값이 빈 배열이다). 그때도 칸에는 |
|
| 65 |
+ * placeholder "010"이 떠서 고른 것처럼 보이는데 값은 빈 문자열이라, 가운데·끝자리를 다 채워도 |
|
| 66 |
+ * 8자리만 제출돼 "휴대전화 번호를 정확히 입력해 주세요."로 막힌다. |
|
| 67 |
+ */ |
|
| 68 |
+export const MOBILE_PHONE_PREFIXES: readonly string[] = [ |
|
| 69 |
+ '010', |
|
| 70 |
+ '011', |
|
| 71 |
+ '016', |
|
| 72 |
+ '017', |
|
| 73 |
+ '018', |
|
| 74 |
+ '019', |
|
| 75 |
+]; |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?