@daeryun/dr_components 1.2.81 → 1.2.83
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/StepOne.jsx +4 -2
- package/dist/components/page/Login/StepOne.tsx +6 -2
- package/dist/components/page/Login/StepTwo.jsx +18 -7
- package/dist/components/page/Login/StepTwo.tsx +23 -7
- package/dist/lib/utils.js +7 -2
- package/dist/lib/utils.ts +7 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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, (
|
|
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((
|
|
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,
|
|
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(
|
|
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
|
|
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 (!
|
|
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:
|
|
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, (
|
|
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((
|
|
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
|
|
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 (!
|
|
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:
|
|
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,
|
|
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(
|
|
367
|
+
signUpGAEvent(String(userIdx ?? ''));
|
|
352
368
|
},
|
|
353
369
|
|
|
354
370
|
|
package/dist/lib/utils.js
CHANGED
|
@@ -432,14 +432,19 @@ export const setCookie = ({ key, value, days = 0.03 }) => {
|
|
|
432
432
|
return '';
|
|
433
433
|
const expires = new Date();
|
|
434
434
|
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
|
|
435
|
-
document.cookie = `${key}=${value};expires=${expires.toUTCString()};path=/`;
|
|
435
|
+
document.cookie = `${key}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/`;
|
|
436
436
|
};
|
|
437
437
|
export const getCookie = (key) => {
|
|
438
438
|
if (typeof document === 'undefined')
|
|
439
439
|
return '';
|
|
440
440
|
const cookies = document.cookie.split(';');
|
|
441
441
|
for (const cookie of cookies) {
|
|
442
|
-
const
|
|
442
|
+
const trimmed = cookie.trim();
|
|
443
|
+
const eqIndex = trimmed.indexOf('=');
|
|
444
|
+
if (eqIndex === -1)
|
|
445
|
+
continue;
|
|
446
|
+
const k = trimmed.slice(0, eqIndex);
|
|
447
|
+
const v = trimmed.slice(eqIndex + 1);
|
|
443
448
|
if (k === key) {
|
|
444
449
|
return v;
|
|
445
450
|
}
|
package/dist/lib/utils.ts
CHANGED
|
@@ -479,7 +479,7 @@ export const setCookie = ({ key, value, days = 0.03 }: { key: string; value: str
|
|
|
479
479
|
|
|
480
480
|
const expires = new Date();
|
|
481
481
|
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
|
|
482
|
-
document.cookie = `${key}=${value};expires=${expires.toUTCString()};path=/`;
|
|
482
|
+
document.cookie = `${key}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/`;
|
|
483
483
|
};
|
|
484
484
|
|
|
485
485
|
export const getCookie = (key: string) => {
|
|
@@ -487,7 +487,12 @@ export const getCookie = (key: string) => {
|
|
|
487
487
|
|
|
488
488
|
const cookies = document.cookie.split(';');
|
|
489
489
|
for (const cookie of cookies) {
|
|
490
|
-
const
|
|
490
|
+
const trimmed = cookie.trim();
|
|
491
|
+
const eqIndex = trimmed.indexOf('=');
|
|
492
|
+
if (eqIndex === -1) continue;
|
|
493
|
+
|
|
494
|
+
const k = trimmed.slice(0, eqIndex);
|
|
495
|
+
const v = trimmed.slice(eqIndex + 1);
|
|
491
496
|
if (k === key) {
|
|
492
497
|
return v;
|
|
493
498
|
}
|