@daeryun/dr_components 0.9.21 → 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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +58 -63
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +62 -62
- 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
|
@@ -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 = () => {
|
|
@@ -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
|
건너뛰기
|
|
@@ -10,11 +10,27 @@ 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 = ({ type_idx, tag_title, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
|
|
14
16
|
const [tooltipStyle, setTooltipStyle] = useState({});
|
|
15
17
|
const buttonRef = useRef(null);
|
|
16
18
|
const tooltipRef = useRef(null);
|
|
17
19
|
const [tooltipArrowLeft, setTooltipArrowLeft] = useState('50%');
|
|
20
|
+
// sessionStorage 업데이트 함수
|
|
21
|
+
const updateSessionStorage = (newSelectedList) => {
|
|
22
|
+
try {
|
|
23
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
24
|
+
if (existingLogin) {
|
|
25
|
+
const loginData = JSON.parse(existingLogin);
|
|
26
|
+
loginData.selectedFields = newSelectedList.map(String);
|
|
27
|
+
sessionStorage.setItem('login', JSON.stringify(loginData));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('SessionStorage 업데이트 실패:', error);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
18
34
|
// 외부 클릭 시 툴팁 닫기
|
|
19
35
|
useEffect(() => {
|
|
20
36
|
if (activeTooltipId !== type_idx)
|
|
@@ -53,7 +69,9 @@ const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, act
|
|
|
53
69
|
}
|
|
54
70
|
};
|
|
55
71
|
if (selected) {
|
|
56
|
-
|
|
72
|
+
const newSelectedList = selectedList.filter(item => item !== type_idx);
|
|
73
|
+
setSelectedList(newSelectedList);
|
|
74
|
+
updateSessionStorage(newSelectedList);
|
|
57
75
|
setActiveTooltipId(null);
|
|
58
76
|
clearTooltipTimer();
|
|
59
77
|
}
|
|
@@ -94,7 +112,9 @@ const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, act
|
|
|
94
112
|
}, 3000000);
|
|
95
113
|
return;
|
|
96
114
|
}
|
|
97
|
-
|
|
115
|
+
const newSelectedList = [...selectedList, type_idx];
|
|
116
|
+
setSelectedList(newSelectedList);
|
|
117
|
+
updateSessionStorage(newSelectedList);
|
|
98
118
|
setActiveTooltipId(null);
|
|
99
119
|
clearTooltipTimer();
|
|
100
120
|
}
|
|
@@ -447,7 +467,96 @@ const StepTwo = () => {
|
|
|
447
467
|
}
|
|
448
468
|
]
|
|
449
469
|
};
|
|
450
|
-
|
|
470
|
+
const doneMutation = useMutation({
|
|
471
|
+
mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
|
|
472
|
+
const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
|
|
473
|
+
method: 'POST',
|
|
474
|
+
headers: { 'Content-Type': 'application/json' },
|
|
475
|
+
body: JSON.stringify({ marketing_agree: bodyData.marketing_agree })
|
|
476
|
+
});
|
|
477
|
+
if (!marketingResponse.ok) {
|
|
478
|
+
throw new Error('마케팅 동의 API 호출 실패');
|
|
479
|
+
}
|
|
480
|
+
const userResponse = yield fetch(`/api/lawfirm/app/user`, {
|
|
481
|
+
method: 'PATCH',
|
|
482
|
+
headers: { 'Content-Type': 'application/json' },
|
|
483
|
+
body: JSON.stringify({
|
|
484
|
+
name: bodyData.name,
|
|
485
|
+
phoneNumber: bodyData.phoneNumber,
|
|
486
|
+
uuid: bodyData.uuid,
|
|
487
|
+
categoryAndField: {
|
|
488
|
+
categories: bodyData.categoryAndField.categories,
|
|
489
|
+
fields: bodyData.categoryAndField.fields
|
|
490
|
+
}
|
|
491
|
+
})
|
|
492
|
+
});
|
|
493
|
+
if (!userResponse.ok) {
|
|
494
|
+
throw new Error('사용자 정보 API 호출 실패');
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
marketing: yield marketingResponse.json(),
|
|
498
|
+
user: yield userResponse.json()
|
|
499
|
+
};
|
|
500
|
+
}),
|
|
501
|
+
onSuccess: () => {
|
|
502
|
+
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
503
|
+
window.location.href = redirect;
|
|
504
|
+
},
|
|
505
|
+
onError: error => {
|
|
506
|
+
console.error('Skip API 호출 실패:', error);
|
|
507
|
+
// 필요시 에러 처리 로직 추가
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
const handlePrev = () => {
|
|
511
|
+
window.location.href = '/login/sign/step_one';
|
|
512
|
+
};
|
|
513
|
+
const handleDone = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
514
|
+
try {
|
|
515
|
+
// session storage에서 login 정보 가져오기
|
|
516
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
517
|
+
if (!existingLogin) {
|
|
518
|
+
console.error('로그인 정보가 없습니다.');
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const loginData = JSON.parse(existingLogin);
|
|
522
|
+
// 필수 정보 확인
|
|
523
|
+
if (!loginData.name || !loginData.phoneNumber || !loginData.uuid) {
|
|
524
|
+
console.error('필수 정보가 부족합니다.');
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const categories = loginData.selectedCategories;
|
|
528
|
+
const fields = selectedList.map(String);
|
|
529
|
+
// API 호출
|
|
530
|
+
doneMutation.mutate({
|
|
531
|
+
name: loginData.name,
|
|
532
|
+
phoneNumber: loginData.phoneNumber,
|
|
533
|
+
uuid: loginData.uuid,
|
|
534
|
+
categoryAndField: { categories, fields },
|
|
535
|
+
marketing_agree: loginData.marketing_agree
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
catch (error) {
|
|
539
|
+
console.error('Session storage parsing error:', error);
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
// 페이지 로드 시 세션 스토리지에서 기존 선택값 복원
|
|
543
|
+
useEffect(() => {
|
|
544
|
+
try {
|
|
545
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
546
|
+
if (existingLogin) {
|
|
547
|
+
const loginData = JSON.parse(existingLogin);
|
|
548
|
+
if (loginData.selectedFields && Array.isArray(loginData.selectedFields)) {
|
|
549
|
+
// 문자열 배열을 숫자 배열로 변환
|
|
550
|
+
const restoredList = loginData.selectedFields.map((field) => parseInt(field, 10));
|
|
551
|
+
setSelectedList(restoredList);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
catch (error) {
|
|
556
|
+
console.error('SessionStorage에서 선택된 필드 복원 실패:', error);
|
|
557
|
+
}
|
|
558
|
+
}, []);
|
|
559
|
+
console.log('selectedList:', selectedList);
|
|
451
560
|
return (<>
|
|
452
561
|
<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] ">
|
|
453
562
|
<div className="">
|
|
@@ -495,13 +604,13 @@ const StepTwo = () => {
|
|
|
495
604
|
</div>
|
|
496
605
|
<div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[79px]">
|
|
497
606
|
<div className="flex w-full flex-row items-center justify-center gap-[8px]">
|
|
498
|
-
<button type={'button'} onClick={
|
|
607
|
+
<button type={'button'} onClick={handlePrev} className={` bg-[#EDEDED] text-grayScale3` +
|
|
499
608
|
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
500
609
|
' max-lg:body_medium2 max-lg:h-[60px] max-lg:w-[620px] ' +
|
|
501
610
|
' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-full '}>
|
|
502
611
|
이전
|
|
503
612
|
</button>
|
|
504
|
-
<button type={'button'} onClick={
|
|
613
|
+
<button type={'button'} onClick={handleDone} className={` ${selectedList.length > 0 ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-grayScale3 '} ` +
|
|
505
614
|
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
506
615
|
' max-lg:body_medium2 max-lg:h-[60px] max-lg:w-[620px] ' +
|
|
507
616
|
' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-full '}>
|