@daeryun/dr_components 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +69 -58
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +68 -68
- package/dist/components/page/Login/LoginComp/Update/MyPageOptionalCheckBox.jsx +2 -2
- package/dist/components/page/Login/LoginComp/Update/MyPageOptionalCheckBox.tsx +2 -2
- package/dist/components/page/Login/Personal.jsx +49 -24
- package/dist/components/page/Login/Personal.tsx +76 -41
- package/dist/components/page/Login/StepOne.jsx +4 -1
- package/dist/components/page/Login/StepOne.tsx +4 -1
- package/dist/components/page/Login/StepTwo.jsx +4 -1
- package/dist/components/page/Login/StepTwo.tsx +4 -1
- package/dist/components/page/Login/_api/optionalTermAgree.d.ts +1 -0
- package/dist/components/page/Login/_api/optionalTermAgree.js +3 -0
- package/dist/components/page/Login/_api/optionalTermAgree.ts +8 -1
- package/dist/styles/globals.css +347 -347
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -506,74 +506,74 @@ const SignContainer = ({
|
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
508
|
|
|
509
|
-
const completeUser = async ({
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}: {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}) => {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
};
|
|
509
|
+
// const completeUser = async ({
|
|
510
|
+
// completeBodyData,
|
|
511
|
+
// termBodyData
|
|
512
|
+
// }: {
|
|
513
|
+
// completeBodyData: { name: string; phoneNumber: string; uuid: string };
|
|
514
|
+
// termBodyData: {
|
|
515
|
+
// marketing_agree: number;
|
|
516
|
+
// };
|
|
517
|
+
// }) => {
|
|
518
|
+
// // 이름 설정
|
|
519
|
+
// if (!userValidObj.nameValid) {
|
|
520
|
+
// const { title, subTitle, key } = modalValueSet[modalValueSetKey.nameError];
|
|
521
|
+
// setModalObj({ title: title, subTitle: subTitle, key });
|
|
522
|
+
// setIsModal(true);
|
|
523
|
+
// return;
|
|
524
|
+
// }
|
|
525
|
+
//
|
|
526
|
+
// // 전화번호 인증 완료 여부
|
|
527
|
+
// if (!userValidObj.codeValid || !userObj.uuid) {
|
|
528
|
+
// const { title, subTitle, key } = modalValueSet[modalValueSetKey.sendNumberComplete];
|
|
529
|
+
// setModalObj({ title: title, subTitle: subTitle, key });
|
|
530
|
+
// setIsModal(true);
|
|
531
|
+
// return;
|
|
532
|
+
// }
|
|
533
|
+
//
|
|
534
|
+
// // 약관
|
|
535
|
+
// if (!requiredTermItems.slice(1).every(item => item.checked)) {
|
|
536
|
+
// const { title, subTitle, key } = modalValueSet[modalValueSetKey.termRequiredError];
|
|
537
|
+
// setModalObj({ title: title, subTitle: subTitle, key });
|
|
538
|
+
// setIsModal(true);
|
|
539
|
+
// return;
|
|
540
|
+
// }
|
|
541
|
+
//
|
|
542
|
+
// // 약관 저장
|
|
543
|
+
// const termResult = await optionalTermAgree({
|
|
544
|
+
// bodyData: termBodyData
|
|
545
|
+
// });
|
|
546
|
+
// if (!termResult.result) {
|
|
547
|
+
// // alert('회원가입 실패');
|
|
548
|
+
// return;
|
|
549
|
+
// }
|
|
550
|
+
//
|
|
551
|
+
// // 회원가입 완료
|
|
552
|
+
// const result = await completeUserSign({
|
|
553
|
+
// bodyData: completeBodyData
|
|
554
|
+
// });
|
|
555
|
+
// // 가입 성공여부
|
|
556
|
+
// if (result.result) {
|
|
557
|
+
// setIsUserSignedUp(true);
|
|
558
|
+
//
|
|
559
|
+
// const userData = {
|
|
560
|
+
// email: userJwtObj.email,
|
|
561
|
+
// name: completeBodyData.name,
|
|
562
|
+
// provider: userJwtObj.provider,
|
|
563
|
+
// isLogin: true
|
|
564
|
+
// };
|
|
565
|
+
// setUser && sessionStorage.setItem(session_key || '', JSON.stringify(userData));
|
|
566
|
+
// setUser && setUser(userData);
|
|
567
|
+
// // await signRedirect(redirect);
|
|
568
|
+
//
|
|
569
|
+
// // await createToken(jwtToken);
|
|
570
|
+
// // router.push(redirect);
|
|
571
|
+
// window.location.href = redirect;
|
|
572
|
+
// // window.location.href = `/api/auth/redirect?redirect=${encodeURIComponent(redirect)}`;
|
|
573
|
+
// } else {
|
|
574
|
+
// await deleteToken();
|
|
575
|
+
// }
|
|
576
|
+
// };
|
|
577
577
|
|
|
578
578
|
// 다음 버튼 클릭 시 전역변수 설정 및 Step1으로 이동
|
|
579
579
|
const handleNext = () => {
|
|
@@ -4,9 +4,9 @@ const MyPageOptionalCheckBox = ({ title, cautionTitle, isContent, checked, name,
|
|
|
4
4
|
const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
|
|
5
5
|
return (<div className={' ' + ` body_medium2 ` + ' max-lg2:body_medium2_tb ' + ' max-sm:body_medium2_mo '}>
|
|
6
6
|
<div className={' flex flex-row ' + ' max-lg2:gap-[20px] ' + ' max-sm:flex-col max-sm:gap-[12px] '}>
|
|
7
|
-
<div className={'flex
|
|
7
|
+
<div className={' flex w-[420px] flex-row items-center gap-[8px] ' +
|
|
8
8
|
' max-xl:w-[420px] ' +
|
|
9
|
-
' max-lg2:w-[
|
|
9
|
+
' max-lg2:w-[370px] ' +
|
|
10
10
|
' max-lg:w-[380px] '}>
|
|
11
11
|
<div className={' ' +
|
|
12
12
|
' body_medium2 text-[#000000] ' +
|
|
@@ -29,9 +29,9 @@ const MyPageOptionalCheckBox = ({
|
|
|
29
29
|
<div className={' flex flex-row ' + ' max-lg2:gap-[20px] ' + ' max-sm:flex-col max-sm:gap-[12px] '}>
|
|
30
30
|
<div
|
|
31
31
|
className={
|
|
32
|
-
'flex
|
|
32
|
+
' flex w-[420px] flex-row items-center gap-[8px] ' +
|
|
33
33
|
' max-xl:w-[420px] ' +
|
|
34
|
-
' max-lg2:w-[
|
|
34
|
+
' max-lg2:w-[370px] ' +
|
|
35
35
|
' max-lg:w-[380px] '
|
|
36
36
|
}
|
|
37
37
|
>
|
|
@@ -30,7 +30,7 @@ import ConfirmModal from './LoginComp/Modal/ConfirmModal';
|
|
|
30
30
|
import MyPageOptionalCheckBox from './LoginComp/Update/MyPageOptionalCheckBox';
|
|
31
31
|
import { optionalTermAgree } from './_api/optionalTermAgree';
|
|
32
32
|
const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px] `, resetUser, setUser }) => {
|
|
33
|
-
var _a;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
34
34
|
const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
35
35
|
const router = useRouter();
|
|
36
36
|
const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
|
|
@@ -74,11 +74,26 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
74
74
|
});
|
|
75
75
|
const [optionalTermItems, setOptionalTermItems] = useState([
|
|
76
76
|
{
|
|
77
|
-
title: '
|
|
77
|
+
title: '정보성 알림 수신 설정 (사건 관련)',
|
|
78
78
|
checked: false,
|
|
79
79
|
isContent: true,
|
|
80
80
|
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
81
81
|
name: 'optionalMain',
|
|
82
|
+
agreeKey: 'alert_agree',
|
|
83
|
+
alarmTypeList: [
|
|
84
|
+
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
85
|
+
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
86
|
+
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
87
|
+
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: '광고성 정보 및 마케팅 정보 수신 설정',
|
|
92
|
+
checked: false,
|
|
93
|
+
isContent: true,
|
|
94
|
+
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
95
|
+
name: 'optionalMain',
|
|
96
|
+
agreeKey: 'marketing_agree',
|
|
82
97
|
alarmTypeList: [
|
|
83
98
|
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
84
99
|
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
@@ -146,14 +161,19 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
146
161
|
codeValid: false
|
|
147
162
|
});
|
|
148
163
|
// 이름이 바꼈거나 , 휴대전화 인증을 다시 완료했거나 , 약관 총합 값이 바꼈거나
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
((
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
const alertMask = ((_b = (_a = optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')) === null || _a === void 0 ? void 0 : _a.alarmTypeList) !== null && _b !== void 0 ? _b : [])
|
|
165
|
+
.filter(i => i.checked)
|
|
166
|
+
.reduce((mask, i) => mask | i.value, 0);
|
|
167
|
+
const marketingMask = ((_d = (_c = optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')) === null || _c === void 0 ? void 0 : _c.alarmTypeList) !== null && _d !== void 0 ? _d : [])
|
|
168
|
+
.filter(i => i.checked)
|
|
169
|
+
.reduce((mask, i) => mask | i.value, 0);
|
|
170
|
+
const needUpdate = ((_f = (_e = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _e === void 0 ? void 0 : _e.alert_agree) !== null && _f !== void 0 ? _f : 0) !== alertMask || ((_h = (_g = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _g === void 0 ? void 0 : _g.marketing_agree) !== null && _h !== void 0 ? _h : 0) !== marketingMask;
|
|
171
|
+
const isAll = ((userData === null || userData === void 0 ? void 0 : userData.data.name) !== (userObj === null || userObj === void 0 ? void 0 : userObj.name) && (userValidObj === null || userValidObj === void 0 ? void 0 : userValidObj.nameValid)) || userValidObj.codeValid || needUpdate;
|
|
172
|
+
//
|
|
173
|
+
const updateOptionalTermItems = (agreeKey, value) => setOptionalTermItems(prevItems => prevItems.map(item => item.agreeKey !== agreeKey
|
|
174
|
+
? item
|
|
175
|
+
: Object.assign(Object.assign({}, item), { checked: value > 0, alarmTypeList: item.alarmTypeList.map(alarm => (Object.assign(Object.assign({}, alarm), { checked: (value & alarm.value) !== 0 // 비트 체크
|
|
176
|
+
}))) })));
|
|
157
177
|
useEffect(() => {
|
|
158
178
|
return () => {
|
|
159
179
|
if (timerRef.current) {
|
|
@@ -163,7 +183,8 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
163
183
|
}, []);
|
|
164
184
|
useEffect(() => {
|
|
165
185
|
if (userAgree) {
|
|
166
|
-
updateOptionalTermItems(userAgree.data.
|
|
186
|
+
updateOptionalTermItems('alert_agree', userAgree.data.alert_agree);
|
|
187
|
+
updateOptionalTermItems('marketing_agree', userAgree.data.marketing_agree);
|
|
167
188
|
}
|
|
168
189
|
}, [userAgree]);
|
|
169
190
|
useEffect(() => {
|
|
@@ -316,19 +337,21 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
316
337
|
resetUser && resetUser();
|
|
317
338
|
});
|
|
318
339
|
const updateInfo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
340
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
319
341
|
// // 이름이 바꼈거나 , 휴대전화 인증을 다시 완료했거나 , 약관 총합 값이 바꼈거나
|
|
320
342
|
if (!isAll) {
|
|
321
343
|
return;
|
|
322
344
|
}
|
|
323
345
|
const nameCheck = userData.data.name !== userObj.name && userValidObj.nameValid;
|
|
324
346
|
const phoneCheck = userValidObj.codeValid;
|
|
325
|
-
const termCheck =
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
347
|
+
const termCheck = ((_b = (_a = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _a === void 0 ? void 0 : _a.alert_agree) !== null && _b !== void 0 ? _b : 0) !==
|
|
348
|
+
(((_d = (_c = optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')) === null || _c === void 0 ? void 0 : _c.alarmTypeList) !== null && _d !== void 0 ? _d : [])
|
|
349
|
+
.filter(i => i.checked)
|
|
350
|
+
.reduce((mask, i) => mask | i.value, 0)) ||
|
|
351
|
+
((_f = (_e = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _e === void 0 ? void 0 : _e.marketing_agree) !== null && _f !== void 0 ? _f : 0) !==
|
|
352
|
+
(((_h = (_g = optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')) === null || _g === void 0 ? void 0 : _g.alarmTypeList) !== null && _h !== void 0 ? _h : [])
|
|
353
|
+
.filter(i => i.checked)
|
|
354
|
+
.reduce((mask, i) => mask | i.value, 0));
|
|
332
355
|
let result = true;
|
|
333
356
|
if (nameCheck || phoneCheck) {
|
|
334
357
|
result = yield updateUserInfo({
|
|
@@ -339,12 +362,12 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
339
362
|
if (termCheck) {
|
|
340
363
|
result = yield optionalTermAgree({
|
|
341
364
|
bodyData: {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
marketing_agree: optionalTermItems
|
|
346
|
-
.filter(
|
|
347
|
-
.reduce((
|
|
365
|
+
alert_agree: (((_k = (_j = optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')) === null || _j === void 0 ? void 0 : _j.alarmTypeList) !== null && _k !== void 0 ? _k : [])
|
|
366
|
+
.filter(i => i.checked)
|
|
367
|
+
.reduce((mask, i) => mask | i.value, 0)),
|
|
368
|
+
marketing_agree: (((_m = (_l = optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')) === null || _l === void 0 ? void 0 : _l.alarmTypeList) !== null && _m !== void 0 ? _m : [])
|
|
369
|
+
.filter(i => i.checked)
|
|
370
|
+
.reduce((mask, i) => mask | i.value, 0)),
|
|
348
371
|
}
|
|
349
372
|
}).then(obj => obj.result);
|
|
350
373
|
}
|
|
@@ -353,6 +376,8 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
353
376
|
const queryClient = new QueryClient();
|
|
354
377
|
queryClient.invalidateQueries({ queryKey: ['getLoginInfo'] });
|
|
355
378
|
queryClient.invalidateQueries({ queryKey: ['getLoginStatus'] });
|
|
379
|
+
queryClient.invalidateQueries({ queryKey: ['user', 'agree'] });
|
|
380
|
+
queryClient.invalidateQueries({ queryKey: ['userinfo'] });
|
|
356
381
|
setUser &&
|
|
357
382
|
sessionStorage.setItem(SESSION_KEY, JSON.stringify({
|
|
358
383
|
email: userObj.email,
|
|
@@ -44,6 +44,7 @@ interface IOptionalCheckItem {
|
|
|
44
44
|
name: string;
|
|
45
45
|
isContent: boolean;
|
|
46
46
|
cautionTitle: string;
|
|
47
|
+
agreeKey: string;
|
|
47
48
|
alarmTypeList: IOptionalCheckAlarm[];
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -113,11 +114,26 @@ const Personal = ({
|
|
|
113
114
|
});
|
|
114
115
|
const [optionalTermItems, setOptionalTermItems] = useState<IOptionalCheckItem[]>([
|
|
115
116
|
{
|
|
116
|
-
title: '
|
|
117
|
+
title: '정보성 알림 수신 설정 (사건 관련)',
|
|
117
118
|
checked: false,
|
|
118
119
|
isContent: true,
|
|
119
120
|
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
120
121
|
name: 'optionalMain',
|
|
122
|
+
agreeKey: 'alert_agree',
|
|
123
|
+
alarmTypeList: [
|
|
124
|
+
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
125
|
+
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
126
|
+
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
127
|
+
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
title: '광고성 정보 및 마케팅 정보 수신 설정',
|
|
132
|
+
checked: false,
|
|
133
|
+
isContent: true,
|
|
134
|
+
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
135
|
+
name: 'optionalMain',
|
|
136
|
+
agreeKey: 'marketing_agree',
|
|
121
137
|
alarmTypeList: [
|
|
122
138
|
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
123
139
|
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
@@ -197,23 +213,35 @@ const Personal = ({
|
|
|
197
213
|
});
|
|
198
214
|
|
|
199
215
|
// 이름이 바꼈거나 , 휴대전화 인증을 다시 완료했거나 , 약관 총합 값이 바꼈거나
|
|
216
|
+
const alertMask = (optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')?.alarmTypeList ?? [])
|
|
217
|
+
.filter(i => i.checked)
|
|
218
|
+
.reduce((mask, i) => mask | i.value, 0);
|
|
219
|
+
|
|
220
|
+
const marketingMask = (optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')?.alarmTypeList ?? [])
|
|
221
|
+
.filter(i => i.checked)
|
|
222
|
+
.reduce((mask, i) => mask | i.value, 0);
|
|
223
|
+
|
|
224
|
+
const needUpdate =
|
|
225
|
+
(userAgree?.data?.alert_agree ?? 0) !== alertMask || (userAgree?.data?.marketing_agree ?? 0) !== marketingMask;
|
|
200
226
|
const isAll =
|
|
201
|
-
(userData?.data.name !== userObj?.name && userValidObj?.nameValid) ||
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const updateOptionalTermItems = (marketingAgree: number) => {
|
|
227
|
+
(userData?.data.name !== userObj?.name && userValidObj?.nameValid) || userValidObj.codeValid || needUpdate;
|
|
228
|
+
|
|
229
|
+
//
|
|
230
|
+
const updateOptionalTermItems = (agreeKey: string, value: number) =>
|
|
206
231
|
setOptionalTermItems(prevItems =>
|
|
207
|
-
prevItems.map(item =>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
232
|
+
prevItems.map(item =>
|
|
233
|
+
item.agreeKey !== agreeKey
|
|
234
|
+
? item
|
|
235
|
+
: {
|
|
236
|
+
...item,
|
|
237
|
+
checked: value > 0,
|
|
238
|
+
alarmTypeList: item.alarmTypeList.map(alarm => ({
|
|
239
|
+
...alarm,
|
|
240
|
+
checked: (value & alarm.value) !== 0 // 비트 체크
|
|
241
|
+
}))
|
|
242
|
+
}
|
|
243
|
+
)
|
|
215
244
|
);
|
|
216
|
-
};
|
|
217
245
|
|
|
218
246
|
useEffect(() => {
|
|
219
247
|
return () => {
|
|
@@ -224,7 +252,8 @@ const Personal = ({
|
|
|
224
252
|
}, []);
|
|
225
253
|
useEffect(() => {
|
|
226
254
|
if (userAgree) {
|
|
227
|
-
updateOptionalTermItems(userAgree.data.
|
|
255
|
+
updateOptionalTermItems('alert_agree', userAgree.data.alert_agree);
|
|
256
|
+
updateOptionalTermItems('marketing_agree', userAgree.data.marketing_agree);
|
|
228
257
|
}
|
|
229
258
|
}, [userAgree]);
|
|
230
259
|
|
|
@@ -408,12 +437,14 @@ const Personal = ({
|
|
|
408
437
|
const nameCheck = userData.data.name !== userObj.name && userValidObj.nameValid;
|
|
409
438
|
const phoneCheck = userValidObj.codeValid;
|
|
410
439
|
const termCheck =
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
userAgree
|
|
416
|
-
optionalTermItems
|
|
440
|
+
(userAgree?.data?.alert_agree ?? 0) !==
|
|
441
|
+
((optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')?.alarmTypeList ?? [])
|
|
442
|
+
.filter(i => i.checked)
|
|
443
|
+
.reduce((mask, i) => mask | i.value, 0)) ||
|
|
444
|
+
(userAgree?.data?.marketing_agree ?? 0) !==
|
|
445
|
+
((optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')?.alarmTypeList ?? [])
|
|
446
|
+
.filter(i => i.checked)
|
|
447
|
+
.reduce((mask, i) => mask | i.value, 0));
|
|
417
448
|
|
|
418
449
|
let result = true;
|
|
419
450
|
if (nameCheck || phoneCheck) {
|
|
@@ -427,13 +458,15 @@ const Personal = ({
|
|
|
427
458
|
if (termCheck) {
|
|
428
459
|
result = await optionalTermAgree({
|
|
429
460
|
bodyData: {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
.
|
|
461
|
+
alert_agree:
|
|
462
|
+
((optionalTermItems.find(fi => fi.agreeKey === 'alert_agree')?.alarmTypeList ?? [])
|
|
463
|
+
.filter(i => i.checked)
|
|
464
|
+
.reduce((mask, i) => mask | i.value, 0)),
|
|
465
|
+
|
|
466
|
+
marketing_agree:
|
|
467
|
+
((optionalTermItems.find(fi => fi.agreeKey === 'marketing_agree')?.alarmTypeList ?? [])
|
|
468
|
+
.filter(i => i.checked)
|
|
469
|
+
.reduce((mask, i) => mask | i.value, 0)),
|
|
437
470
|
}
|
|
438
471
|
}).then(obj => obj.result);
|
|
439
472
|
}
|
|
@@ -442,23 +475,25 @@ const Personal = ({
|
|
|
442
475
|
const queryClient = new QueryClient();
|
|
443
476
|
queryClient.invalidateQueries({ queryKey: ['getLoginInfo'] });
|
|
444
477
|
queryClient.invalidateQueries({ queryKey: ['getLoginStatus'] });
|
|
478
|
+
queryClient.invalidateQueries({ queryKey: ['user', 'agree'] });
|
|
479
|
+
queryClient.invalidateQueries({ queryKey: ['userinfo'] });
|
|
445
480
|
setUser &&
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
email: userObj.email,
|
|
450
|
-
name: userObj.name,
|
|
451
|
-
provider: userObj.provider,
|
|
452
|
-
isLogin: true
|
|
453
|
-
})
|
|
454
|
-
);
|
|
455
|
-
setUser &&
|
|
456
|
-
setUser({
|
|
481
|
+
sessionStorage.setItem(
|
|
482
|
+
SESSION_KEY,
|
|
483
|
+
JSON.stringify({
|
|
457
484
|
email: userObj.email,
|
|
458
485
|
name: userObj.name,
|
|
459
486
|
provider: userObj.provider,
|
|
460
487
|
isLogin: true
|
|
461
|
-
})
|
|
488
|
+
})
|
|
489
|
+
);
|
|
490
|
+
setUser &&
|
|
491
|
+
setUser({
|
|
492
|
+
email: userObj.email,
|
|
493
|
+
name: userObj.name,
|
|
494
|
+
provider: userObj.provider,
|
|
495
|
+
isLogin: true
|
|
496
|
+
});
|
|
462
497
|
window.location.href = '/';
|
|
463
498
|
} else {
|
|
464
499
|
return;
|
|
@@ -183,7 +183,10 @@ const StepOne = () => {
|
|
|
183
183
|
const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
|
|
184
184
|
method: 'POST',
|
|
185
185
|
headers: { 'Content-Type': 'application/json' },
|
|
186
|
-
body: JSON.stringify({
|
|
186
|
+
body: JSON.stringify({
|
|
187
|
+
marketing_agree: bodyData.marketing_agree,
|
|
188
|
+
alert_agree: bodyData.marketing_agree
|
|
189
|
+
}) // 회원가입 시에는 alert_agree도 똑같이 들어가게
|
|
187
190
|
});
|
|
188
191
|
if (!marketingResponse.ok) {
|
|
189
192
|
throw new Error('마케팅 동의 API 호출 실패');
|
|
@@ -247,7 +247,10 @@ const StepOne = () => {
|
|
|
247
247
|
const marketingResponse = await fetch(`/api/lawfirm/app/user/agree`, {
|
|
248
248
|
method: 'POST',
|
|
249
249
|
headers: { 'Content-Type': 'application/json' },
|
|
250
|
-
body: JSON.stringify({
|
|
250
|
+
body: JSON.stringify({
|
|
251
|
+
marketing_agree: bodyData.marketing_agree,
|
|
252
|
+
alert_agree: bodyData.marketing_agree
|
|
253
|
+
}) // 회원가입 시에는 alert_agree도 똑같이 들어가게
|
|
251
254
|
});
|
|
252
255
|
|
|
253
256
|
if (!marketingResponse.ok) {
|
|
@@ -217,7 +217,10 @@ const StepTwo = () => {
|
|
|
217
217
|
const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
|
|
218
218
|
method: 'POST',
|
|
219
219
|
headers: { 'Content-Type': 'application/json' },
|
|
220
|
-
body: JSON.stringify({
|
|
220
|
+
body: JSON.stringify({
|
|
221
|
+
marketing_agree: bodyData.marketing_agree,
|
|
222
|
+
alert_agree: bodyData.marketing_agree
|
|
223
|
+
}) // 회원가입 시에는 alert_agree도 똑같이 들어가게
|
|
221
224
|
});
|
|
222
225
|
if (!marketingResponse.ok) {
|
|
223
226
|
throw new Error('마케팅 동의 API 호출 실패');
|
|
@@ -281,7 +281,10 @@ const StepTwo = () => {
|
|
|
281
281
|
const marketingResponse = await fetch(`/api/lawfirm/app/user/agree`, {
|
|
282
282
|
method: 'POST',
|
|
283
283
|
headers: { 'Content-Type': 'application/json' },
|
|
284
|
-
body: JSON.stringify({
|
|
284
|
+
body: JSON.stringify({
|
|
285
|
+
marketing_agree: bodyData.marketing_agree,
|
|
286
|
+
alert_agree: bodyData.marketing_agree
|
|
287
|
+
}) // 회원가입 시에는 alert_agree도 똑같이 들어가게
|
|
285
288
|
});
|
|
286
289
|
|
|
287
290
|
if (!marketingResponse.ok) {
|
|
@@ -13,6 +13,9 @@ export const optionalTermAgree = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
13
13
|
if (!VALID_VALUES.includes(bodyData.marketing_agree)) {
|
|
14
14
|
return { result: false };
|
|
15
15
|
}
|
|
16
|
+
if (!VALID_VALUES.includes(bodyData.alert_agree)) {
|
|
17
|
+
return { result: false };
|
|
18
|
+
}
|
|
16
19
|
try {
|
|
17
20
|
const res = yield Fetch(`/api/lawfirm/app/user/agree`, {
|
|
18
21
|
method: 'POST',
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import Fetch from '../_fetch/fetch';
|
|
2
2
|
|
|
3
|
-
export const optionalTermAgree = async ({
|
|
3
|
+
export const optionalTermAgree = async ({
|
|
4
|
+
bodyData
|
|
5
|
+
}: {
|
|
6
|
+
bodyData: { alert_agree: number; marketing_agree: number };
|
|
7
|
+
}) => {
|
|
4
8
|
const VALID_VALUES = Array.from({ length: 16 }, (_, i) => i);
|
|
5
9
|
if (!VALID_VALUES.includes(bodyData.marketing_agree)) {
|
|
6
10
|
return { result: false };
|
|
7
11
|
}
|
|
12
|
+
if (!VALID_VALUES.includes(bodyData.alert_agree)) {
|
|
13
|
+
return { result: false };
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
try {
|
|
10
17
|
const res = await Fetch(`/api/lawfirm/app/user/agree`, {
|