@daeryun/dr_components 0.9.24 → 0.9.26

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.
@@ -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 = ({ code, code_name, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
16
17
  const [tooltipStyle, setTooltipStyle] = useState({});
17
18
  const buttonRef = useRef(null);
@@ -139,6 +140,11 @@ const StepOne = () => {
139
140
  const [selectedList, setSelectedList] = useState([]);
140
141
  const [activeTooltipId, setActiveTooltipId] = useState(null);
141
142
  const tooltipTimeoutRef = useRef(null);
143
+ const [isModal, setIsModal] = useState(false);
144
+ const [modalObj, setModalObj] = useState({
145
+ title: '',
146
+ subTitle: ''
147
+ });
142
148
  const categories = [
143
149
  { code: 'CT0004', code_name: '기업법무' },
144
150
  { code: 'CT0014', code_name: '지식재산권' },
@@ -166,6 +172,12 @@ const StepOne = () => {
166
172
  { code: 'CT0029', code_name: '디지털포렌식' },
167
173
  { code: 'CT0030', code_name: '경호' }
168
174
  ];
175
+ const modalHandleClose = () => {
176
+ setIsModal(false);
177
+ setModalObj({ title: '', subTitle: '' });
178
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
179
+ window.location.href = redirect;
180
+ };
169
181
  const skipMutation = useMutation({
170
182
  mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
171
183
  const response = yield fetch(`/api/lawfirm/app/user`, {
@@ -181,8 +193,9 @@ const StepOne = () => {
181
193
  return response.json();
182
194
  }),
183
195
  onSuccess: () => {
184
- const redirect = decodeURIComponent(getCookie('redirect')) || '/';
185
- window.location.href = redirect;
196
+ setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
197
+ setIsModal(true);
198
+ sessionStorage.removeItem('login');
186
199
  },
187
200
  onError: error => {
188
201
  console.error('Skip API 호출 실패:', error);
@@ -283,6 +296,8 @@ const StepOne = () => {
283
296
  </button>
284
297
  </div>
285
298
  </div>
299
+
300
+ <ConfirmModal isOpen={isModal} handleClick={modalHandleClose} onClose={modalHandleClose} title={modalObj.title} subTitle={modalObj.subTitle}/>
286
301
  </>);
287
302
  };
288
303
  export default StepOne;
@@ -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
  code,
@@ -199,6 +200,12 @@ const StepOne = () => {
199
200
  const [selectedList, setSelectedList] = useState<string[]>([]);
200
201
  const [activeTooltipId, setActiveTooltipId] = useState<string | null>(null);
201
202
  const tooltipTimeoutRef = useRef<NodeJS.Timeout | null>(null);
203
+ const [isModal, setIsModal] = useState<boolean>(false);
204
+ const [modalObj, setModalObj] = useState<{ title: string; subTitle: string }>({
205
+ title: '',
206
+ subTitle: ''
207
+ });
208
+
202
209
  const categories = [
203
210
  { code: 'CT0004', code_name: '기업법무' },
204
211
  { code: 'CT0014', code_name: '지식재산권' },
@@ -227,6 +234,14 @@ const StepOne = () => {
227
234
  { code: 'CT0030', code_name: '경호' }
228
235
  ];
229
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
+
230
245
  const skipMutation = useMutation({
231
246
  mutationFn: async (bodyData: { name: string; phoneNumber: string; uuid: string }) => {
232
247
  const response = await fetch(`/api/lawfirm/app/user`, {
@@ -244,8 +259,10 @@ const StepOne = () => {
244
259
  return response.json();
245
260
  },
246
261
  onSuccess: () => {
247
- const redirect = decodeURIComponent(getCookie('redirect')) || '/';
248
- window.location.href = redirect;
262
+ setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
263
+ setIsModal(true);
264
+
265
+ sessionStorage.removeItem('login');
249
266
  },
250
267
  onError: error => {
251
268
  console.error('Skip API 호출 실패:', error);
@@ -389,6 +406,14 @@ const StepOne = () => {
389
406
  </button>
390
407
  </div>
391
408
  </div>
409
+
410
+ <ConfirmModal
411
+ isOpen={isModal}
412
+ handleClick={modalHandleClose}
413
+ onClose={modalHandleClose}
414
+ title={modalObj.title}
415
+ subTitle={modalObj.subTitle}
416
+ />
392
417
  </>
393
418
  );
394
419
  };