@daeryun/dr_components 0.4.19 → 0.4.20
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/index.js +2 -0
- package/dist/components/index.ts +5 -0
- package/dist/components/page/Login/AppHeaderContainer.d.ts +8 -0
- package/dist/components/page/Login/AppHeaderContainer.jsx +84 -0
- package/dist/components/page/Login/AppHeaderContainer.tsx +88 -0
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +18 -1
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +25 -1
- package/dist/components/page/Login/LoginShareCheckContainer.jsx +1 -1
- package/dist/components/page/Login/LoginShareCheckContainer.tsx +1 -1
- package/dist/components/page/Login/_api/_server/appLoginInfo.d.ts +0 -1
- package/dist/components/page/Login/_api/_server/appLoginInfo.js +51 -51
- package/dist/components/page/Login/_api/_server/appLoginInfo.ts +53 -53
- package/dist/components/page/Login/_api/checkThirdPartyCookie.d.ts +2 -1
- package/dist/components/page/Login/_api/checkThirdPartyCookie.js +2 -1
- package/dist/components/page/Login/_api/checkThirdPartyCookie.ts +2 -1
- package/dist/styles/globals.css +158 -158
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
27
27
|
import Loader from '../../../Loader/Loader';
|
|
28
28
|
import { ITermType } from '../_types/termType';
|
|
29
29
|
import OptionalCheckBox from './Sign/OptionalCheckBox';
|
|
30
|
+
import { optionalTermAgree } from '../_api/optionalTermAgree';
|
|
30
31
|
|
|
31
32
|
interface IUser {
|
|
32
33
|
name: string;
|
|
@@ -514,9 +515,14 @@ const SignContainer = ({
|
|
|
514
515
|
};
|
|
515
516
|
|
|
516
517
|
const completeUser = async ({
|
|
517
|
-
completeBodyData
|
|
518
|
+
completeBodyData,
|
|
519
|
+
termBodyData
|
|
518
520
|
}: {
|
|
519
521
|
completeBodyData: { name: string; phoneNumber: string; uuid: string };
|
|
522
|
+
termBodyData: {
|
|
523
|
+
alert_agree: number;
|
|
524
|
+
marketing_agree: number;
|
|
525
|
+
};
|
|
520
526
|
}) => {
|
|
521
527
|
// 이름 설정
|
|
522
528
|
if (!userValidObj.nameValid) {
|
|
@@ -542,6 +548,15 @@ const SignContainer = ({
|
|
|
542
548
|
return;
|
|
543
549
|
}
|
|
544
550
|
|
|
551
|
+
// 약관 저장
|
|
552
|
+
const termResult = await optionalTermAgree({
|
|
553
|
+
bodyData: termBodyData
|
|
554
|
+
});
|
|
555
|
+
if (!termResult.result) {
|
|
556
|
+
// alert('회원가입 실패');
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
|
|
545
560
|
// 회원가입 완료
|
|
546
561
|
const result = await completeUserSign({
|
|
547
562
|
bodyData: completeBodyData
|
|
@@ -969,6 +984,15 @@ const SignContainer = ({
|
|
|
969
984
|
name: userObj.name,
|
|
970
985
|
phoneNumber: formatPhoneNumber(userObj.phoneNumber) || '',
|
|
971
986
|
uuid: userObj.uuid
|
|
987
|
+
},
|
|
988
|
+
termBodyData: {
|
|
989
|
+
alert_agree: optionalTermItems[0].alarmTypeList
|
|
990
|
+
.filter(item => item.checked)
|
|
991
|
+
.reduce((sum, item) => sum + item.value, 0), // checked된 항목들의 value 합산
|
|
992
|
+
|
|
993
|
+
marketing_agree: optionalTermItems[1].alarmTypeList
|
|
994
|
+
.filter(item => item.checked)
|
|
995
|
+
.reduce((sum, item) => sum + item.value, 0) // 마케팅 관련 동의 값 합산
|
|
972
996
|
}
|
|
973
997
|
});
|
|
974
998
|
}}
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import React, { useEffect } from 'react';
|
|
12
12
|
import { usePathname, useRouter } from 'next/navigation';
|
|
13
13
|
import Fetch from './_fetch/fetch';
|
|
14
|
-
import
|
|
14
|
+
import checkThirdPartyCookie from './_api/checkThirdPartyCookie';
|
|
15
15
|
import { fetchAuthCallback } from './_api/fetchAuthCallback';
|
|
16
16
|
import { fetchUserData } from './_api/fetchUserData';
|
|
17
17
|
const LoginShareCheckContainer = ({ children, setUserInfo }) => {
|
|
@@ -4,7 +4,7 @@ import React, { ReactNode, useEffect } from 'react';
|
|
|
4
4
|
import { usePathname, useRouter } from 'next/navigation';
|
|
5
5
|
import Fetch from './_fetch/fetch';
|
|
6
6
|
import { ILoginInfo } from './_types/login';
|
|
7
|
-
import
|
|
7
|
+
import checkThirdPartyCookie from './_api/checkThirdPartyCookie';
|
|
8
8
|
import { fetchAuthCallback } from './_api/fetchAuthCallback';
|
|
9
9
|
import { fetchUserData } from './_api/fetchUserData';
|
|
10
10
|
|
|
@@ -7,14 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { checkThirdPartyCookie } from '../checkThirdPartyCookie';
|
|
11
|
-
import { fetchAuthCallback } from '../fetchAuthCallback';
|
|
12
10
|
import { fetchUserData } from '../fetchUserData';
|
|
13
11
|
import { cookies } from 'next/headers';
|
|
14
12
|
export const appLoginInfo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
const isCookieAllowed =
|
|
13
|
+
// const isCookieAllowed = await checkThirdPartyCookie();
|
|
16
14
|
const cookieStore = yield cookies();
|
|
17
|
-
const nullData = { userInfo: { isLogin: false, provider: '', name: '', email: '' }
|
|
15
|
+
// const nullData = { userInfo: { isLogin: false, provider: '', name: '', email: '' } };
|
|
18
16
|
// 모든 쿠키를 `{ key: value }` 객체로 변환 (값이 없으면 `''` 반환)
|
|
19
17
|
const cookieObject = Object.fromEntries(cookieStore.getAll().map(cookie => [cookie.name, cookie.value || '']) // 값이 없을 경우 `''`
|
|
20
18
|
);
|
|
@@ -23,52 +21,54 @@ export const appLoginInfo = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
23
21
|
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
24
22
|
.join('; ') || ''; // 모든 쿠키가 없을 경우 빈 문자열 반환
|
|
25
23
|
// 쿠키 허용
|
|
26
|
-
if (isCookieAllowed) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return { userInfo: userData, isCookie: isCookieAllowed };
|
|
63
|
-
}
|
|
24
|
+
// if (isCookieAllowed) {
|
|
25
|
+
// // 이지스에 로그인 쿠키 있는지 확인
|
|
26
|
+
// const result = await fetchAuthCallback(cookieHeader);
|
|
27
|
+
//
|
|
28
|
+
// // 이지스에 쿠키가 존재 => 이 유저는 로그인한 유저
|
|
29
|
+
// if (result.result && result.jwt) {
|
|
30
|
+
// // next 에 이미 쿠키가 있는지 확인
|
|
31
|
+
// const tokenCheckResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
32
|
+
// method: 'GET',
|
|
33
|
+
// headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
|
|
34
|
+
// credentials: 'include'
|
|
35
|
+
// }).then(res => res.json());
|
|
36
|
+
// // 이미 있으므로 이 유저는 로그인 유저임
|
|
37
|
+
// if (tokenCheckResult.token) {
|
|
38
|
+
// const userData = await fetchUserData(cookieHeader);
|
|
39
|
+
// return { userInfo: userData, isCookie: isCookieAllowed };
|
|
40
|
+
// }
|
|
41
|
+
// // 쿠키가 없어서 만들고 나서 요청
|
|
42
|
+
// else {
|
|
43
|
+
// const createResult = await createTokenAndFetchUser(result.jwt, cookieHeader);
|
|
44
|
+
// if (createResult) {
|
|
45
|
+
// const userData = await fetchUserData(cookieHeader);
|
|
46
|
+
// return { userInfo: userData, isCookie: isCookieAllowed };
|
|
47
|
+
// } else {
|
|
48
|
+
// return nullData;
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// } else {
|
|
52
|
+
// // 이유저는 비로그인 유저
|
|
53
|
+
// return nullData;
|
|
54
|
+
// }
|
|
55
|
+
// } else {
|
|
56
|
+
// 이거는 계속 날려주면 됨
|
|
57
|
+
const userData = yield fetchUserData(cookieHeader);
|
|
58
|
+
return { userInfo: userData };
|
|
59
|
+
// }
|
|
64
60
|
});
|
|
65
61
|
export default appLoginInfo;
|
|
66
|
-
const createTokenAndFetchUser = (jwt, cookies) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
// const createTokenAndFetchUser = async (jwt: string, cookies?: string) => {
|
|
63
|
+
// const createTokenResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
64
|
+
// body: JSON.stringify({ jwt }),
|
|
65
|
+
// method: 'POST',
|
|
66
|
+
// headers: {
|
|
67
|
+
// 'Content-Type': 'application/json',
|
|
68
|
+
// ...(cookies !== '' ? { Cookie: cookies } : {})
|
|
69
|
+
// },
|
|
70
|
+
// credentials: 'include'
|
|
71
|
+
// }).then(res => res.json());
|
|
72
|
+
//
|
|
73
|
+
// return createTokenResult.token;
|
|
74
|
+
// };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import checkThirdPartyCookie from '../checkThirdPartyCookie';
|
|
2
2
|
import { fetchAuthCallback } from '../fetchAuthCallback';
|
|
3
3
|
import { fetchUserData } from '../fetchUserData';
|
|
4
4
|
import { cookies } from 'next/headers';
|
|
5
5
|
import { ILoginInfo } from '../../_types/login';
|
|
6
6
|
|
|
7
|
-
export const appLoginInfo = async (): Promise<{ userInfo: ILoginInfo
|
|
8
|
-
const isCookieAllowed = await checkThirdPartyCookie();
|
|
7
|
+
export const appLoginInfo = async (): Promise<{ userInfo: ILoginInfo }> => {
|
|
8
|
+
// const isCookieAllowed = await checkThirdPartyCookie();
|
|
9
9
|
const cookieStore = await cookies();
|
|
10
10
|
|
|
11
|
-
const nullData = { userInfo: { isLogin: false, provider: '', name: '', email: '' }
|
|
11
|
+
// const nullData = { userInfo: { isLogin: false, provider: '', name: '', email: '' } };
|
|
12
12
|
|
|
13
13
|
// 모든 쿠키를 `{ key: value }` 객체로 변환 (값이 없으면 `''` 반환)
|
|
14
14
|
const cookieObject = Object.fromEntries(
|
|
@@ -22,56 +22,56 @@ export const appLoginInfo = async (): Promise<{ userInfo: ILoginInfo; isCookie:
|
|
|
22
22
|
.join('; ') || ''; // 모든 쿠키가 없을 경우 빈 문자열 반환
|
|
23
23
|
|
|
24
24
|
// 쿠키 허용
|
|
25
|
-
if (isCookieAllowed) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} else {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
25
|
+
// if (isCookieAllowed) {
|
|
26
|
+
// // 이지스에 로그인 쿠키 있는지 확인
|
|
27
|
+
// const result = await fetchAuthCallback(cookieHeader);
|
|
28
|
+
//
|
|
29
|
+
// // 이지스에 쿠키가 존재 => 이 유저는 로그인한 유저
|
|
30
|
+
// if (result.result && result.jwt) {
|
|
31
|
+
// // next 에 이미 쿠키가 있는지 확인
|
|
32
|
+
// const tokenCheckResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
33
|
+
// method: 'GET',
|
|
34
|
+
// headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
|
|
35
|
+
// credentials: 'include'
|
|
36
|
+
// }).then(res => res.json());
|
|
37
|
+
// // 이미 있으므로 이 유저는 로그인 유저임
|
|
38
|
+
// if (tokenCheckResult.token) {
|
|
39
|
+
// const userData = await fetchUserData(cookieHeader);
|
|
40
|
+
// return { userInfo: userData, isCookie: isCookieAllowed };
|
|
41
|
+
// }
|
|
42
|
+
// // 쿠키가 없어서 만들고 나서 요청
|
|
43
|
+
// else {
|
|
44
|
+
// const createResult = await createTokenAndFetchUser(result.jwt, cookieHeader);
|
|
45
|
+
// if (createResult) {
|
|
46
|
+
// const userData = await fetchUserData(cookieHeader);
|
|
47
|
+
// return { userInfo: userData, isCookie: isCookieAllowed };
|
|
48
|
+
// } else {
|
|
49
|
+
// return nullData;
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
// } else {
|
|
53
|
+
// // 이유저는 비로그인 유저
|
|
54
|
+
// return nullData;
|
|
55
|
+
// }
|
|
56
|
+
// } else {
|
|
57
|
+
// 이거는 계속 날려주면 됨
|
|
58
|
+
const userData = await fetchUserData(cookieHeader);
|
|
59
|
+
return { userInfo: userData };
|
|
60
|
+
// }
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export default appLoginInfo;
|
|
64
64
|
|
|
65
|
-
const createTokenAndFetchUser = async (jwt: string, cookies?: string) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
65
|
+
// const createTokenAndFetchUser = async (jwt: string, cookies?: string) => {
|
|
66
|
+
// const createTokenResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
67
|
+
// body: JSON.stringify({ jwt }),
|
|
68
|
+
// method: 'POST',
|
|
69
|
+
// headers: {
|
|
70
|
+
// 'Content-Type': 'application/json',
|
|
71
|
+
// ...(cookies !== '' ? { Cookie: cookies } : {})
|
|
72
|
+
// },
|
|
73
|
+
// credentials: 'include'
|
|
74
|
+
// }).then(res => res.json());
|
|
75
|
+
//
|
|
76
|
+
// return createTokenResult.token;
|
|
77
|
+
// };
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
/** 쿠키 허용 여부 확인 */
|
|
11
|
-
|
|
11
|
+
const checkThirdPartyCookie = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
try {
|
|
13
13
|
const createCookieResult = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth`, {
|
|
14
14
|
method: 'POST',
|
|
@@ -27,3 +27,4 @@ export const checkThirdPartyCookie = () => __awaiter(void 0, void 0, void 0, fun
|
|
|
27
27
|
}
|
|
28
28
|
return false;
|
|
29
29
|
});
|
|
30
|
+
export default checkThirdPartyCookie;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 쿠키 허용 여부 확인 */
|
|
2
|
-
|
|
2
|
+
const checkThirdPartyCookie = async () => {
|
|
3
3
|
try {
|
|
4
4
|
const createCookieResult = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth`, {
|
|
5
5
|
method: 'POST',
|
|
@@ -19,3 +19,4 @@ export const checkThirdPartyCookie = async () => {
|
|
|
19
19
|
}
|
|
20
20
|
return false;
|
|
21
21
|
};
|
|
22
|
+
export default checkThirdPartyCookie;
|