@daeryun/dr_components 0.9.25 → 0.9.27

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.
@@ -234,6 +234,14 @@ const StepOne = () => {
234
234
  { code: 'CT0030', code_name: '경호' }
235
235
  ];
236
236
 
237
+ const modalHandleClose = () => {
238
+ setIsModal(false);
239
+ setModalObj({ title: '', subTitle: '' });
240
+
241
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
242
+ window.location.href = redirect;
243
+ };
244
+
237
245
  const skipMutation = useMutation({
238
246
  mutationFn: async (bodyData: { name: string; phoneNumber: string; uuid: string }) => {
239
247
  const response = await fetch(`/api/lawfirm/app/user`, {
@@ -251,8 +259,10 @@ const StepOne = () => {
251
259
  return response.json();
252
260
  },
253
261
  onSuccess: () => {
254
- const redirect = decodeURIComponent(getCookie('redirect')) || '/';
255
- window.location.href = redirect;
262
+ setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
263
+ setIsModal(true);
264
+
265
+ sessionStorage.removeItem('login');
256
266
  },
257
267
  onError: error => {
258
268
  console.error('Skip API 호출 실패:', error);
@@ -260,12 +270,6 @@ const StepOne = () => {
260
270
  }
261
271
  });
262
272
 
263
- const modalHandleClose = () => {
264
- setIsModal(false);
265
- setModalObj({ title: '', subTitle: '' });
266
- window.location.href = '/login/sign/step_two';
267
- };
268
-
269
273
  // 다음 버튼 클릭 시 세션 스토리지에 category 값 저장
270
274
  const handleNext = async () => {
271
275
  const existingLogin = sessionStorage.getItem('login');
@@ -286,10 +290,7 @@ const StepOne = () => {
286
290
 
287
291
  sessionStorage.setItem('login', JSON.stringify(updatedLoginData));
288
292
 
289
- setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
290
- setIsModal(true);
291
-
292
- sessionStorage.removeItem('login');
293
+ window.location.href = '/login/sign/step_two';
293
294
  };
294
295
 
295
296
  const handleSkip = async () => {
@@ -12,6 +12,7 @@ import React, { useEffect, useRef, useState } from 'react';
12
12
  import Image from 'next/image';
13
13
  import { useMutation } from '@tanstack/react-query';
14
14
  import { getCookie } from '../../../lib';
15
+ import ConfirmModal from './LoginComp/Modal/ConfirmModal';
15
16
  const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
16
17
  const [tooltipStyle, setTooltipStyle] = useState({});
17
18
  const buttonRef = useRef(null);
@@ -156,6 +157,11 @@ const StepTwo = () => {
156
157
  const [activeTooltipId, setActiveTooltipId] = useState(null);
157
158
  const tooltipTimeoutRef = useRef(null);
158
159
  // const { data: categories, isLoading: categoriesLoading } = actionGetDetailCategoryList('CT0001');
160
+ const [isModal, setIsModal] = useState(false);
161
+ const [modalObj, setModalObj] = useState({
162
+ title: '',
163
+ subTitle: ''
164
+ });
159
165
  const center_code = 'CT0001';
160
166
  const center_code2 = 'CT0025';
161
167
  const categories = [
@@ -467,6 +473,12 @@ const StepTwo = () => {
467
473
  }
468
474
  ]
469
475
  };
476
+ const modalHandleClose = () => {
477
+ setIsModal(false);
478
+ setModalObj({ title: '', subTitle: '' });
479
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
480
+ window.location.href = redirect;
481
+ };
470
482
  const doneMutation = useMutation({
471
483
  mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
472
484
  const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
@@ -499,8 +511,9 @@ const StepTwo = () => {
499
511
  };
500
512
  }),
501
513
  onSuccess: () => {
502
- const redirect = decodeURIComponent(getCookie('redirect')) || '/';
503
- window.location.href = redirect;
514
+ setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
515
+ setIsModal(true);
516
+ sessionStorage.removeItem('login');
504
517
  },
505
518
  onError: error => {
506
519
  console.error('Skip API 호출 실패:', error);
@@ -556,7 +569,6 @@ const StepTwo = () => {
556
569
  console.error('SessionStorage에서 선택된 필드 복원 실패:', error);
557
570
  }
558
571
  }, []);
559
- console.log('selectedList:', selectedList);
560
572
  return (<>
561
573
  <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] ">
562
574
  <div className="">
@@ -619,6 +631,8 @@ const StepTwo = () => {
619
631
  </div>
620
632
  </div>
621
633
  </div>
634
+
635
+ <ConfirmModal isOpen={isModal} handleClick={modalHandleClose} onClose={modalHandleClose} title={modalObj.title} subTitle={modalObj.subTitle}/>
622
636
  </>);
623
637
  };
624
638
  export default StepTwo;
@@ -4,6 +4,7 @@ import React, { useEffect, useRef, useState } from 'react';
4
4
  import Image from 'next/image';
5
5
  import { useMutation } from '@tanstack/react-query';
6
6
  import { getCookie } from '../../../lib';
7
+ import ConfirmModal from './LoginComp/Modal/ConfirmModal';
7
8
 
8
9
  const Box = ({
9
10
  type_idx,
@@ -203,6 +204,11 @@ const StepTwo = () => {
203
204
  const [activeTooltipId, setActiveTooltipId] = useState<number | null>(null);
204
205
  const tooltipTimeoutRef = useRef<NodeJS.Timeout | null>(null);
205
206
  // const { data: categories, isLoading: categoriesLoading } = actionGetDetailCategoryList('CT0001');
207
+ const [isModal, setIsModal] = useState<boolean>(false);
208
+ const [modalObj, setModalObj] = useState<{ title: string; subTitle: string }>({
209
+ title: '',
210
+ subTitle: ''
211
+ });
206
212
 
207
213
  const center_code = 'CT0001';
208
214
  const center_code2 = 'CT0025';
@@ -516,6 +522,14 @@ const StepTwo = () => {
516
522
  ]
517
523
  };
518
524
 
525
+ const modalHandleClose = () => {
526
+ setIsModal(false);
527
+ setModalObj({ title: '', subTitle: '' });
528
+
529
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
530
+ window.location.href = redirect;
531
+ };
532
+
519
533
  const doneMutation = useMutation({
520
534
  mutationFn: async (bodyData: {
521
535
  name: string;
@@ -558,8 +572,10 @@ const StepTwo = () => {
558
572
  };
559
573
  },
560
574
  onSuccess: () => {
561
- const redirect = decodeURIComponent(getCookie('redirect')) || '/';
562
- window.location.href = redirect;
575
+ setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
576
+ setIsModal(true);
577
+
578
+ sessionStorage.removeItem('login');
563
579
  },
564
580
  onError: error => {
565
581
  console.error('Skip API 호출 실패:', error);
@@ -622,8 +638,6 @@ const StepTwo = () => {
622
638
  }
623
639
  }, []);
624
640
 
625
- console.log('selectedList:', selectedList);
626
-
627
641
  return (
628
642
  <>
629
643
  <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] ">
@@ -733,6 +747,14 @@ const StepTwo = () => {
733
747
  </div>
734
748
  </div>
735
749
  </div>
750
+
751
+ <ConfirmModal
752
+ isOpen={isModal}
753
+ handleClick={modalHandleClose}
754
+ onClose={modalHandleClose}
755
+ title={modalObj.title}
756
+ subTitle={modalObj.subTitle}
757
+ />
736
758
  </>
737
759
  );
738
760
  };