@daeryun/dr_components 0.9.22 → 0.9.23
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/components/page/Login/LoginComp/SignContainer.jsx +59 -64
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +63 -63
- package/dist/components/page/Login/StepOne.jsx +83 -4
- package/dist/components/page/Login/StepOne.tsx +101 -5
- package/dist/components/page/Login/StepTwo.jsx +114 -5
- package/dist/components/page/Login/StepTwo.tsx +131 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -11,10 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react';
|
|
12
12
|
import { useRouter } from 'next/navigation';
|
|
13
13
|
import { formatPhoneNumber, formatTime, getCookie, getNameValue, getPhoneValue, onlyNumberFilter } from '../../../../lib';
|
|
14
|
-
import { getToken } from '../_api/token';
|
|
14
|
+
import { deleteToken, getToken } from '../_api/token';
|
|
15
15
|
import { jwtDecode } from 'jwt-decode';
|
|
16
16
|
import { sendNumber } from '../_api/sendNumber';
|
|
17
17
|
import { confirmNumber } from '../_api/confirmNumber';
|
|
18
|
+
import { completeUserSign } from '../_api/completeUser';
|
|
18
19
|
import PageWrapper from '../../../Layout/PageWrapper';
|
|
19
20
|
import LoginBreadCrumb from './LoginBreadCrumb';
|
|
20
21
|
import ConfirmModal from './Modal/ConfirmModal';
|
|
@@ -26,6 +27,7 @@ import Image from 'next/image';
|
|
|
26
27
|
import { useQuery } from '@tanstack/react-query';
|
|
27
28
|
import Loader from '../../../Loader/Loader';
|
|
28
29
|
import OptionalCheckBox from './Sign/OptionalCheckBox';
|
|
30
|
+
import { optionalTermAgree } from '../_api/optionalTermAgree';
|
|
29
31
|
const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, setUser }) => {
|
|
30
32
|
var _a, _b;
|
|
31
33
|
const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
@@ -392,68 +394,61 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
392
394
|
setIsModal(true);
|
|
393
395
|
}
|
|
394
396
|
});
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
// // router.push(redirect);
|
|
451
|
-
// window.location.href = redirect;
|
|
452
|
-
// // window.location.href = `/api/auth/redirect?redirect=${encodeURIComponent(redirect)}`;
|
|
453
|
-
// } else {
|
|
454
|
-
// await deleteToken();
|
|
455
|
-
// }
|
|
456
|
-
// };
|
|
397
|
+
const completeUser = (_a) => __awaiter(void 0, [_a], void 0, function* ({ completeBodyData, termBodyData }) {
|
|
398
|
+
// 이름 설정
|
|
399
|
+
if (!userValidObj.nameValid) {
|
|
400
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.nameError];
|
|
401
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
402
|
+
setIsModal(true);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
// 전화번호 인증 완료 여부
|
|
406
|
+
if (!userValidObj.codeValid || !userObj.uuid) {
|
|
407
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.sendNumberComplete];
|
|
408
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
409
|
+
setIsModal(true);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
// 약관
|
|
413
|
+
if (!requiredTermItems.slice(1).every(item => item.checked)) {
|
|
414
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.termRequiredError];
|
|
415
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
416
|
+
setIsModal(true);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
// 약관 저장
|
|
420
|
+
const termResult = yield optionalTermAgree({
|
|
421
|
+
bodyData: termBodyData
|
|
422
|
+
});
|
|
423
|
+
if (!termResult.result) {
|
|
424
|
+
// alert('회원가입 실패');
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// 회원가입 완료
|
|
428
|
+
const result = yield completeUserSign({
|
|
429
|
+
bodyData: completeBodyData
|
|
430
|
+
});
|
|
431
|
+
// 가입 성공여부
|
|
432
|
+
if (result.result) {
|
|
433
|
+
setIsUserSignedUp(true);
|
|
434
|
+
const userData = {
|
|
435
|
+
email: userJwtObj.email,
|
|
436
|
+
name: completeBodyData.name,
|
|
437
|
+
provider: userJwtObj.provider,
|
|
438
|
+
isLogin: true
|
|
439
|
+
};
|
|
440
|
+
setUser && sessionStorage.setItem(session_key || '', JSON.stringify(userData));
|
|
441
|
+
setUser && setUser(userData);
|
|
442
|
+
// await signRedirect(redirect);
|
|
443
|
+
// await createToken(jwtToken);
|
|
444
|
+
// router.push(redirect);
|
|
445
|
+
window.location.href = redirect;
|
|
446
|
+
// window.location.href = `/api/auth/redirect?redirect=${encodeURIComponent(redirect)}`;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
yield deleteToken();
|
|
450
|
+
}
|
|
451
|
+
});
|
|
457
452
|
// 다음 버튼 클릭 시 전역변수 설정 및 Step1으로 이동
|
|
458
453
|
const handleNext = () => {
|
|
459
454
|
// 이름 설정 체크
|
|
@@ -489,7 +484,7 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
489
484
|
marketing_agree: marketingAgree
|
|
490
485
|
};
|
|
491
486
|
sessionStorage.setItem('login', JSON.stringify(loginData));
|
|
492
|
-
|
|
487
|
+
window.location.href = '/login/sign/step_one';
|
|
493
488
|
};
|
|
494
489
|
const modalHandleClose = () => {
|
|
495
490
|
setIsModal(false);
|
|
@@ -494,74 +494,74 @@ const SignContainer = ({
|
|
|
494
494
|
}
|
|
495
495
|
};
|
|
496
496
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
497
|
+
const completeUser = async ({
|
|
498
|
+
completeBodyData,
|
|
499
|
+
termBodyData
|
|
500
|
+
}: {
|
|
501
|
+
completeBodyData: { name: string; phoneNumber: string; uuid: string };
|
|
502
|
+
termBodyData: {
|
|
503
|
+
marketing_agree: number;
|
|
504
|
+
};
|
|
505
|
+
}) => {
|
|
506
|
+
// 이름 설정
|
|
507
|
+
if (!userValidObj.nameValid) {
|
|
508
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.nameError];
|
|
509
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
510
|
+
setIsModal(true);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
513
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
514
|
+
// 전화번호 인증 완료 여부
|
|
515
|
+
if (!userValidObj.codeValid || !userObj.uuid) {
|
|
516
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.sendNumberComplete];
|
|
517
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
518
|
+
setIsModal(true);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
521
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
522
|
+
// 약관
|
|
523
|
+
if (!requiredTermItems.slice(1).every(item => item.checked)) {
|
|
524
|
+
const { title, subTitle, key } = modalValueSet[modalValueSetKey.termRequiredError];
|
|
525
|
+
setModalObj({ title: title, subTitle: subTitle, key });
|
|
526
|
+
setIsModal(true);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
529
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
530
|
+
// 약관 저장
|
|
531
|
+
const termResult = await optionalTermAgree({
|
|
532
|
+
bodyData: termBodyData
|
|
533
|
+
});
|
|
534
|
+
if (!termResult.result) {
|
|
535
|
+
// alert('회원가입 실패');
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
538
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
539
|
+
// 회원가입 완료
|
|
540
|
+
const result = await completeUserSign({
|
|
541
|
+
bodyData: completeBodyData
|
|
542
|
+
});
|
|
543
|
+
// 가입 성공여부
|
|
544
|
+
if (result.result) {
|
|
545
|
+
setIsUserSignedUp(true);
|
|
546
546
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
547
|
+
const userData = {
|
|
548
|
+
email: userJwtObj.email,
|
|
549
|
+
name: completeBodyData.name,
|
|
550
|
+
provider: userJwtObj.provider,
|
|
551
|
+
isLogin: true
|
|
552
|
+
};
|
|
553
|
+
setUser && sessionStorage.setItem(session_key || '', JSON.stringify(userData));
|
|
554
|
+
setUser && setUser(userData);
|
|
555
|
+
// await signRedirect(redirect);
|
|
556
556
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
557
|
+
// await createToken(jwtToken);
|
|
558
|
+
// router.push(redirect);
|
|
559
|
+
window.location.href = redirect;
|
|
560
|
+
// window.location.href = `/api/auth/redirect?redirect=${encodeURIComponent(redirect)}`;
|
|
561
|
+
} else {
|
|
562
|
+
await deleteToken();
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
565
|
|
|
566
566
|
// 다음 버튼 클릭 시 전역변수 설정 및 Step1으로 이동
|
|
567
567
|
const handleNext = () => {
|
|
@@ -604,7 +604,7 @@ const SignContainer = ({
|
|
|
604
604
|
|
|
605
605
|
sessionStorage.setItem('login', JSON.stringify(loginData));
|
|
606
606
|
|
|
607
|
-
|
|
607
|
+
window.location.href = '/login/sign/step_one';
|
|
608
608
|
};
|
|
609
609
|
|
|
610
610
|
const modalHandleClose = () => {
|
|
@@ -10,6 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
import React, { useEffect, useRef, useState } from 'react';
|
|
12
12
|
import Image from 'next/image';
|
|
13
|
+
import { useMutation } from '@tanstack/react-query';
|
|
14
|
+
import { getCookie } from '../../../lib';
|
|
13
15
|
const Box = ({ code, code_name, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
|
|
14
16
|
const [tooltipStyle, setTooltipStyle] = useState({});
|
|
15
17
|
const buttonRef = useRef(null);
|
|
@@ -164,6 +166,85 @@ const StepOne = () => {
|
|
|
164
166
|
{ code: 'CT0029', code_name: '디지털포렌식' },
|
|
165
167
|
{ code: 'CT0030', code_name: '경호' }
|
|
166
168
|
];
|
|
169
|
+
const skipMutation = useMutation({
|
|
170
|
+
mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
+
const response = yield fetch(`/api/lawfirm/app/user`, {
|
|
172
|
+
method: 'PATCH',
|
|
173
|
+
headers: {
|
|
174
|
+
'Content-Type': 'application/json'
|
|
175
|
+
},
|
|
176
|
+
body: JSON.stringify(bodyData)
|
|
177
|
+
});
|
|
178
|
+
if (!response.ok) {
|
|
179
|
+
throw new Error('API 호출 실패');
|
|
180
|
+
}
|
|
181
|
+
return response.json();
|
|
182
|
+
}),
|
|
183
|
+
onSuccess: () => {
|
|
184
|
+
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
185
|
+
window.location.href = redirect;
|
|
186
|
+
},
|
|
187
|
+
onError: error => {
|
|
188
|
+
console.error('Skip API 호출 실패:', error);
|
|
189
|
+
// 필요시 에러 처리 로직 추가
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
// 다음 버튼 클릭 시 세션 스토리지에 category 값 저장
|
|
193
|
+
const handleNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
194
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
195
|
+
let loginData = {};
|
|
196
|
+
if (existingLogin) {
|
|
197
|
+
try {
|
|
198
|
+
loginData = JSON.parse(existingLogin);
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
console.error('Session storage parsing error:', e);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const updatedLoginData = Object.assign(Object.assign({}, loginData), { selectedCategories: selectedList });
|
|
205
|
+
sessionStorage.setItem('login', JSON.stringify(updatedLoginData));
|
|
206
|
+
window.location.href = '/login/sign/step_two';
|
|
207
|
+
});
|
|
208
|
+
const handleSkip = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
|
+
try {
|
|
210
|
+
// session storage에서 login 정보 가져오기
|
|
211
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
212
|
+
if (!existingLogin) {
|
|
213
|
+
console.error('로그인 정보가 없습니다.');
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const loginData = JSON.parse(existingLogin);
|
|
217
|
+
// 필수 정보 확인
|
|
218
|
+
if (!loginData.name || !loginData.phoneNumber || !loginData.uuid) {
|
|
219
|
+
console.error('필수 정보가 부족합니다.');
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
// API 호출
|
|
223
|
+
skipMutation.mutate({
|
|
224
|
+
name: loginData.name,
|
|
225
|
+
phoneNumber: loginData.phoneNumber,
|
|
226
|
+
uuid: loginData.uuid
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
console.error('Session storage parsing error:', error);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
// 페이지 로드 시 세션 스토리지에서 기존 선택값 복원
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
236
|
+
if (existingLogin) {
|
|
237
|
+
try {
|
|
238
|
+
const loginData = JSON.parse(existingLogin);
|
|
239
|
+
if (loginData.selectedCategories && Array.isArray(loginData.selectedCategories)) {
|
|
240
|
+
setSelectedList(loginData.selectedCategories);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
console.error('Session storage parsing error:', e);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, []);
|
|
167
248
|
return (<>
|
|
168
249
|
<div className="relative mx-[200px] mt-[150px] max-[1498px]:mx-[120px] max-lg:mx-[60px] max-sm:mx-[20px] sm:mt-[240px] lg:mt-[200px] ">
|
|
169
250
|
<div className="">
|
|
@@ -191,15 +272,13 @@ const StepOne = () => {
|
|
|
191
272
|
{categories.map(item => (<Box key={item.code} code={item.code} code_name={item.code_name} selected={selectedList.includes(item.code)} selectedList={selectedList} setSelectedList={setSelectedList} activeTooltipId={activeTooltipId} setActiveTooltipId={setActiveTooltipId} tooltipTimeoutRef={tooltipTimeoutRef}/>))}
|
|
192
273
|
</div>
|
|
193
274
|
<div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[218px]">
|
|
194
|
-
<button type={'button'} onClick={
|
|
275
|
+
<button type={'button'} onClick={handleNext} className={` ${selectedList.length > 0 ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-grayScale3 '} ` +
|
|
195
276
|
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
196
277
|
' max-lg:body_medium2 max-lg:h-[60px] max-lg:w-[620px] ' +
|
|
197
278
|
' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-full '}>
|
|
198
279
|
다음
|
|
199
280
|
</button>
|
|
200
|
-
<button type={'button'} onClick={
|
|
201
|
-
//추가해야함
|
|
202
|
-
})} className="body_small2_mo sm:body_small2_tb lg:body_small2 mt-[12px] text-grayScale2 underline sm:mt-[20px] lg:mt-[40px]">
|
|
281
|
+
<button type={'button'} onClick={handleSkip} className="body_small2_mo sm:body_small2_tb lg:body_small2 mt-[12px] text-grayScale2 underline sm:mt-[20px] lg:mt-[40px]">
|
|
203
282
|
건너뛰기
|
|
204
283
|
</button>
|
|
205
284
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
3
2
|
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
+
import { useMutation } from '@tanstack/react-query';
|
|
6
|
+
import { getCookie } from '../../../lib';
|
|
5
7
|
|
|
6
8
|
const Box = ({
|
|
7
9
|
code,
|
|
@@ -224,6 +226,102 @@ const StepOne = () => {
|
|
|
224
226
|
{ code: 'CT0029', code_name: '디지털포렌식' },
|
|
225
227
|
{ code: 'CT0030', code_name: '경호' }
|
|
226
228
|
];
|
|
229
|
+
|
|
230
|
+
const skipMutation = useMutation({
|
|
231
|
+
mutationFn: async (bodyData: { name: string; phoneNumber: string; uuid: string }) => {
|
|
232
|
+
const response = await fetch(`/api/lawfirm/app/user`, {
|
|
233
|
+
method: 'PATCH',
|
|
234
|
+
headers: {
|
|
235
|
+
'Content-Type': 'application/json'
|
|
236
|
+
},
|
|
237
|
+
body: JSON.stringify(bodyData)
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
if (!response.ok) {
|
|
241
|
+
throw new Error('API 호출 실패');
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return response.json();
|
|
245
|
+
},
|
|
246
|
+
onSuccess: () => {
|
|
247
|
+
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
248
|
+
window.location.href = redirect;
|
|
249
|
+
},
|
|
250
|
+
onError: error => {
|
|
251
|
+
console.error('Skip API 호출 실패:', error);
|
|
252
|
+
// 필요시 에러 처리 로직 추가
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// 다음 버튼 클릭 시 세션 스토리지에 category 값 저장
|
|
257
|
+
const handleNext = async () => {
|
|
258
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
259
|
+
let loginData = {};
|
|
260
|
+
|
|
261
|
+
if (existingLogin) {
|
|
262
|
+
try {
|
|
263
|
+
loginData = JSON.parse(existingLogin);
|
|
264
|
+
} catch (e) {
|
|
265
|
+
console.error('Session storage parsing error:', e);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const updatedLoginData = {
|
|
270
|
+
...loginData,
|
|
271
|
+
selectedCategories: selectedList
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
sessionStorage.setItem('login', JSON.stringify(updatedLoginData));
|
|
275
|
+
|
|
276
|
+
window.location.href = '/login/sign/step_two';
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const handleSkip = async () => {
|
|
280
|
+
try {
|
|
281
|
+
// session storage에서 login 정보 가져오기
|
|
282
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
283
|
+
|
|
284
|
+
if (!existingLogin) {
|
|
285
|
+
console.error('로그인 정보가 없습니다.');
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const loginData = JSON.parse(existingLogin);
|
|
290
|
+
|
|
291
|
+
// 필수 정보 확인
|
|
292
|
+
if (!loginData.name || !loginData.phoneNumber || !loginData.uuid) {
|
|
293
|
+
console.error('필수 정보가 부족합니다.');
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// API 호출
|
|
298
|
+
skipMutation.mutate({
|
|
299
|
+
name: loginData.name,
|
|
300
|
+
phoneNumber: loginData.phoneNumber,
|
|
301
|
+
uuid: loginData.uuid
|
|
302
|
+
});
|
|
303
|
+
} catch (error) {
|
|
304
|
+
console.error('Session storage parsing error:', error);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// 페이지 로드 시 세션 스토리지에서 기존 선택값 복원
|
|
309
|
+
useEffect(() => {
|
|
310
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
311
|
+
|
|
312
|
+
if (existingLogin) {
|
|
313
|
+
try {
|
|
314
|
+
const loginData = JSON.parse(existingLogin);
|
|
315
|
+
|
|
316
|
+
if (loginData.selectedCategories && Array.isArray(loginData.selectedCategories)) {
|
|
317
|
+
setSelectedList(loginData.selectedCategories);
|
|
318
|
+
}
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.error('Session storage parsing error:', e);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}, []);
|
|
324
|
+
|
|
227
325
|
return (
|
|
228
326
|
<>
|
|
229
327
|
<div className="relative mx-[200px] mt-[150px] max-[1498px]:mx-[120px] max-lg:mx-[60px] max-sm:mx-[20px] sm:mt-[240px] lg:mt-[200px] ">
|
|
@@ -272,7 +370,7 @@ const StepOne = () => {
|
|
|
272
370
|
<div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[218px]">
|
|
273
371
|
<button
|
|
274
372
|
type={'button'}
|
|
275
|
-
onClick={
|
|
373
|
+
onClick={handleNext}
|
|
276
374
|
className={
|
|
277
375
|
` ${selectedList.length > 0 ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-grayScale3 '} ` +
|
|
278
376
|
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
@@ -284,9 +382,7 @@ const StepOne = () => {
|
|
|
284
382
|
</button>
|
|
285
383
|
<button
|
|
286
384
|
type={'button'}
|
|
287
|
-
onClick={
|
|
288
|
-
//추가해야함
|
|
289
|
-
}}
|
|
385
|
+
onClick={handleSkip}
|
|
290
386
|
className="body_small2_mo sm:body_small2_tb lg:body_small2 mt-[12px] text-grayScale2 underline sm:mt-[20px] lg:mt-[40px]"
|
|
291
387
|
>
|
|
292
388
|
건너뛰기
|