@daeryun/dr_components 1.2.81 → 1.2.82

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.
@@ -243,14 +243,16 @@ const StepOne = () => {
243
243
  onSuccess: (data) => {
244
244
  var _a, _b;
245
245
  console.log('data: ', data);
246
+ const userIdx = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.idx;
246
247
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
247
- const newRedirect = appendUuidToRedirect(redirect, (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.data.idx);
248
+ const newRedirect = appendUuidToRedirect(redirect, String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
249
+ console.log('newRedirect:', newRedirect);
248
250
  setCookie({ key: 'redirect', value: newRedirect });
249
251
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
250
252
  setIsModal(true);
251
253
  sessionStorage.removeItem('login');
252
254
  // ga trigger
253
- signUpGAEvent((_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.uuid);
255
+ signUpGAEvent(String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
254
256
  },
255
257
  onError: error => {
256
258
  console.error('Skip API 호출 실패:', error);
@@ -311,8 +311,12 @@ const StepOne = () => {
311
311
  },
312
312
  onSuccess: (data) => {
313
313
  console.log('data: ', data);
314
+ const userIdx = data?.user?.data?.idx;
315
+
314
316
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
315
- const newRedirect = appendUuidToRedirect(redirect, data?.user?.data.idx);
317
+ const newRedirect = appendUuidToRedirect(redirect, String(userIdx ?? ''));
318
+ console.log('newRedirect:', newRedirect);
319
+
316
320
  setCookie({ key: 'redirect', value: newRedirect });
317
321
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
318
322
  setIsModal(true);
@@ -320,7 +324,7 @@ const StepOne = () => {
320
324
  sessionStorage.removeItem('login');
321
325
 
322
326
  // ga trigger
323
- signUpGAEvent(data?.user?.uuid);
327
+ signUpGAEvent(String(userIdx ?? ''));
324
328
  },
325
329
  onError: error => {
326
330
  console.error('Skip API 호출 실패:', error);
@@ -248,7 +248,7 @@ const StepTwo = () => {
248
248
  if (!marketingResponse.ok) {
249
249
  throw new Error('마케팅 동의 API 호출 실패');
250
250
  }
251
- const userResponse = yield fetch(`/api/lawfirm/app/user`, {
251
+ const userPatchResponse = yield fetch(`/api/lawfirm/app/user`, {
252
252
  method: 'PATCH',
253
253
  headers: { 'Content-Type': 'application/json' },
254
254
  body: JSON.stringify({
@@ -261,26 +261,37 @@ const StepTwo = () => {
261
261
  }
262
262
  })
263
263
  });
264
- if (!userResponse.ok) {
264
+ if (!userPatchResponse.ok) {
265
265
  throw new Error('사용자 정보 API 호출 실패');
266
266
  }
267
+ // PATCH 성공 후 GET으로 상세 정보 조회
268
+ const userGetResponse = yield fetch(`/api/lawfirm/app/user`, {
269
+ method: 'GET',
270
+ headers: { 'Content-Type': 'application/json' },
271
+ credentials: 'include'
272
+ });
273
+ if (!userGetResponse.ok) {
274
+ throw new Error('사용자 정보 조회 실패');
275
+ }
276
+ const userData = yield userGetResponse.json();
267
277
  return {
268
278
  marketing: yield marketingResponse.json(),
269
- user: yield userResponse.json()
279
+ user: userData
270
280
  };
271
281
  }),
272
282
  onSuccess: (data) => {
273
283
  var _a, _b;
284
+ console.log('data: ', data);
285
+ const userIdx = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.idx;
274
286
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
275
- const newRedirect = appendUuidToRedirect(redirect, (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.uuid);
287
+ const newRedirect = appendUuidToRedirect(redirect, String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
288
+ console.log('newRedirect:', newRedirect);
276
289
  setCookie({ key: 'redirect', value: newRedirect });
277
- console.log('data: ', data);
278
- console.log('newRedirect', newRedirect);
279
290
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
280
291
  setIsModal(true);
281
292
  sessionStorage.removeItem('login');
282
293
  // ga trigger
283
- signUpGAEvent((_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.uuid);
294
+ signUpGAEvent(String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
284
295
  },
285
296
  onError: error => {
286
297
  console.error('Skip API 호출 실패:', error);
@@ -313,7 +313,7 @@ const StepTwo = () => {
313
313
  throw new Error('마케팅 동의 API 호출 실패');
314
314
  }
315
315
 
316
- const userResponse = await fetch(`/api/lawfirm/app/user`, {
316
+ const userPatchResponse = await fetch(`/api/lawfirm/app/user`, {
317
317
  method: 'PATCH',
318
318
  headers: { 'Content-Type': 'application/json' },
319
319
  body: JSON.stringify({
@@ -327,28 +327,44 @@ const StepTwo = () => {
327
327
  })
328
328
  });
329
329
 
330
- if (!userResponse.ok) {
330
+ if (!userPatchResponse.ok) {
331
331
  throw new Error('사용자 정보 API 호출 실패');
332
332
  }
333
333
 
334
+ // PATCH 성공 후 GET으로 상세 정보 조회
335
+ const userGetResponse = await fetch(`/api/lawfirm/app/user`, {
336
+ method: 'GET',
337
+ headers: { 'Content-Type': 'application/json' },
338
+ credentials: 'include'
339
+ });
340
+
341
+ if (!userGetResponse.ok) {
342
+ throw new Error('사용자 정보 조회 실패');
343
+ }
344
+
345
+ const userData = await userGetResponse.json();
346
+
334
347
  return {
335
348
  marketing: await marketingResponse.json(),
336
- user: await userResponse.json()
349
+ user: userData
337
350
  };
338
351
  },
339
352
  onSuccess: (data) => {
353
+ console.log('data: ', data);
354
+ const userIdx = data?.user?.data?.idx;
355
+
340
356
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
341
- const newRedirect = appendUuidToRedirect(redirect, data?.user?.uuid);
357
+ const newRedirect = appendUuidToRedirect(redirect, String(userIdx ?? ''));
358
+ console.log('newRedirect:', newRedirect);
359
+
342
360
  setCookie({ key: 'redirect', value: newRedirect });
343
- console.log('data: ', data);
344
- console.log('newRedirect', newRedirect);
345
361
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
346
362
  setIsModal(true);
347
363
 
348
364
  sessionStorage.removeItem('login');
349
365
 
350
366
  // ga trigger
351
- signUpGAEvent(data?.user?.uuid);
367
+ signUpGAEvent(String(userIdx ?? ''));
352
368
  },
353
369
 
354
370