@daeryun/dr_components 1.2.25 → 1.2.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.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/components/page/Login/Login.d.ts +2 -1
- package/dist/components/page/Login/Login.jsx +2 -2
- package/dist/components/page/Login/Login.tsx +9 -2
- package/dist/components/page/Login/LoginComp/LoginContainer.d.ts +2 -1
- package/dist/components/page/Login/LoginComp/LoginContainer.jsx +48 -8
- package/dist/components/page/Login/LoginComp/LoginContainer.tsx +59 -8
- package/dist/components/page/Login/_api/checkLogoutLog.d.ts +3 -0
- package/dist/components/page/Login/_api/checkLogoutLog.js +56 -0
- package/dist/components/page/Login/_api/checkLogoutLog.ts +49 -0
- package/dist/components/page/Login/_api/logout.js +9 -7
- package/dist/components/page/Login/_api/logout.ts +10 -7
- package/dist/components/page/Login/_fetch/fetch.js +20 -1
- package/dist/components/page/Login/_fetch/fetch.ts +23 -1
- package/dist/styles/globals.css +442 -409
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { useEffect } from 'react';
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
|
5
5
|
import Image from 'next/image';
|
|
6
6
|
import PageWrapper from '../../../Layout/PageWrapper';
|
|
@@ -8,11 +8,15 @@ import { setCookie } from '../../../../lib';
|
|
|
8
8
|
import LoginBreadCrumb from './LoginBreadCrumb';
|
|
9
9
|
import { ILoginInfo } from '../_types/login';
|
|
10
10
|
import { fetchUserData } from '../_api/fetchUserData';
|
|
11
|
+
import checkThirdPartyCookie from '../_api/checkThirdPartyCookie';
|
|
12
|
+
import { checkLogoutLog } from '../_api/checkLogoutLog';
|
|
13
|
+
import { fetchAuthCallback } from '../_api/fetchAuthCallback';
|
|
11
14
|
|
|
12
15
|
interface props {
|
|
13
16
|
layoutClassName?: string; // 높이 및 마진값 조절
|
|
14
17
|
state: string;
|
|
15
18
|
isTestLogin?: boolean;
|
|
19
|
+
isCheckRecentLogin?: boolean;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
const LoginContainer = ({
|
|
@@ -24,7 +28,8 @@ const LoginContainer = ({
|
|
|
24
28
|
' max-lg:mt-[112px] ' +
|
|
25
29
|
' max-sm:mt-[100px] ',
|
|
26
30
|
state,
|
|
27
|
-
isTestLogin = false
|
|
31
|
+
isTestLogin = false,
|
|
32
|
+
isCheckRecentLogin = false // 배포중 에러방지를 위해 조건부 추가
|
|
28
33
|
}: props) => {
|
|
29
34
|
const router = useRouter();
|
|
30
35
|
const searchParam = useSearchParams();
|
|
@@ -39,31 +44,65 @@ const LoginContainer = ({
|
|
|
39
44
|
a.click();
|
|
40
45
|
};
|
|
41
46
|
|
|
47
|
+
const [recentLoginProvider, setRecentLoginProvider] = useState<'kakao' | 'google' | 'naver' | 'apple' | string>('');
|
|
48
|
+
|
|
42
49
|
const userCheck = async (): Promise<boolean> => {
|
|
43
50
|
const result: ILoginInfo = await fetchUserData();
|
|
44
51
|
return result.isLogin;
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
useEffect(() => {
|
|
48
|
-
|
|
55
|
+
if (!isCheckRecentLogin) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const checkLogoutLogAction = async () => {
|
|
59
|
+
const isCookie = await checkThirdPartyCookie();
|
|
60
|
+
if (!isCookie) {
|
|
61
|
+
// 쿠키 차단 브라우저에서는 프론트 처리
|
|
62
|
+
const result = await checkLogoutLog();
|
|
63
|
+
if (result?.result) {
|
|
64
|
+
setRecentLoginProvider(result?.data?.provider || '');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 쿠키 허용 브라우저에서는 서버에 요청에서 provider 조회
|
|
68
|
+
else {
|
|
69
|
+
const result = await fetchAuthCallback();
|
|
70
|
+
if (result?.result && result?.provider) {
|
|
71
|
+
setRecentLoginProvider(result?.provider || '');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
checkLogoutLogAction();
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
let attemptCount = 0; // 시도 횟수
|
|
80
|
+
const maxAttempts = 3; // 최대 4번
|
|
81
|
+
const intervalTime = 3000; // 3초
|
|
49
82
|
|
|
50
83
|
const interval = setInterval(async () => {
|
|
84
|
+
attemptCount++;
|
|
85
|
+
|
|
51
86
|
try {
|
|
52
87
|
const result = await userCheck();
|
|
88
|
+
|
|
53
89
|
if (result) {
|
|
54
90
|
const redirect = searchParam.get('redirect');
|
|
55
91
|
const normalized = redirect ? (redirect.startsWith('/') ? redirect : `/${redirect}`) : '/';
|
|
56
|
-
window.location.href = normalized;
|
|
57
|
-
}
|
|
58
92
|
|
|
59
|
-
// 20초가 지나면 interval 정리
|
|
60
|
-
if (Date.now() - start > 15_000) {
|
|
61
93
|
clearInterval(interval);
|
|
94
|
+
window.location.href = normalized;
|
|
95
|
+
return;
|
|
62
96
|
}
|
|
63
97
|
} catch (err) {
|
|
64
98
|
console.error('userCheck 실패:', err);
|
|
65
99
|
}
|
|
66
|
-
|
|
100
|
+
|
|
101
|
+
// 최대 시도 횟수 도달 → 중단
|
|
102
|
+
if (attemptCount >= maxAttempts) {
|
|
103
|
+
clearInterval(interval);
|
|
104
|
+
}
|
|
105
|
+
}, intervalTime);
|
|
67
106
|
|
|
68
107
|
return () => clearInterval(interval);
|
|
69
108
|
}, [searchParam]);
|
|
@@ -191,6 +230,18 @@ const LoginContainer = ({
|
|
|
191
230
|
}
|
|
192
231
|
style={{ color: item.textColor, backgroundColor: item.bgColor }}
|
|
193
232
|
>
|
|
233
|
+
{recentLoginProvider === item.identityProvider && (
|
|
234
|
+
<div
|
|
235
|
+
className={
|
|
236
|
+
' absolute flex items-center justify-center bg-grayScale1 text-grayScale8 ' +
|
|
237
|
+
' max-sm:label_large2_mo max-sm:-top-[10px] max-sm:right-[0px] max-sm:h-[22px] max-sm:rounded-[4px] max-sm:px-[6px] ' +
|
|
238
|
+
' max-lg:label_large2_tb max-lg:-top-[10px] max-lg:right-[10px] max-lg:h-[31px] max-lg:rounded-[8px] max-lg:px-[10px] ' +
|
|
239
|
+
' label_large2 -top-[12px] right-[14px] h-[37px] rounded-[12px] px-[14px] '
|
|
240
|
+
}
|
|
241
|
+
>
|
|
242
|
+
<p className={`!leading-none`}>최근 로그인</p>
|
|
243
|
+
</div>
|
|
244
|
+
)}
|
|
194
245
|
<span className={`${item.positionClass} absolute ${item.iconClassName}`}>
|
|
195
246
|
<Image
|
|
196
247
|
src={`${imagePath}/common-login/${item.identityProvider}.svg`}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const checkLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
try {
|
|
12
|
+
const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
headers: {
|
|
15
|
+
'Content-Type': 'application/json'
|
|
16
|
+
},
|
|
17
|
+
credentials: 'include'
|
|
18
|
+
}).then(obj => obj.json());
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
// 브라우저 쿠키 차단시 쿠키 생성
|
|
26
|
+
export const createLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json'
|
|
32
|
+
},
|
|
33
|
+
credentials: 'include'
|
|
34
|
+
}).then(obj => obj.json());
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// 브라우저 쿠키 차단시 쿠키 삭제
|
|
42
|
+
export const deleteLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
45
|
+
method: 'DELETE',
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json'
|
|
48
|
+
},
|
|
49
|
+
credentials: 'include'
|
|
50
|
+
}).then(obj => obj.json());
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const checkLogoutLog = async () => {
|
|
4
|
+
try {
|
|
5
|
+
const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
6
|
+
method: 'GET',
|
|
7
|
+
headers: {
|
|
8
|
+
'Content-Type': 'application/json'
|
|
9
|
+
},
|
|
10
|
+
credentials: 'include'
|
|
11
|
+
}).then(obj => obj.json());
|
|
12
|
+
|
|
13
|
+
return result;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// 브라우저 쿠키 차단시 쿠키 생성
|
|
20
|
+
export const createLogoutLog = async () => {
|
|
21
|
+
try {
|
|
22
|
+
const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json'
|
|
26
|
+
},
|
|
27
|
+
credentials: 'include'
|
|
28
|
+
}).then(obj => obj.json());
|
|
29
|
+
return result;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 브라우저 쿠키 차단시 쿠키 삭제
|
|
36
|
+
export const deleteLogoutLog = async () => {
|
|
37
|
+
try {
|
|
38
|
+
const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
|
|
39
|
+
method: 'DELETE',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json'
|
|
42
|
+
},
|
|
43
|
+
credentials: 'include'
|
|
44
|
+
}).then(obj => obj.json());
|
|
45
|
+
return result;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -7,18 +7,20 @@ 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 Fetch from "../_fetch/fetch";
|
|
10
11
|
const logout = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
12
|
const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
12
13
|
try {
|
|
13
|
-
|
|
14
|
-
// method: 'POST'
|
|
15
|
-
// });
|
|
16
|
-
const res = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
14
|
+
const res = yield Fetch(`/api/lawfirm/app/auth/logout`, {
|
|
17
15
|
method: 'POST',
|
|
18
|
-
headers: { 'Content-Type': 'application/json' },
|
|
19
|
-
cache: 'no-cache',
|
|
20
16
|
credentials: 'include'
|
|
21
|
-
})
|
|
17
|
+
});
|
|
18
|
+
// const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
19
|
+
// method: 'POST',
|
|
20
|
+
// headers: { 'Content-Type': 'application/json' },
|
|
21
|
+
// cache: 'no-cache',
|
|
22
|
+
// credentials: 'include'
|
|
23
|
+
// }).then((res) => res.json())
|
|
22
24
|
if (res.result) {
|
|
23
25
|
const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
24
26
|
method: 'DELETE',
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import Fetch from "../_fetch/fetch";
|
|
2
|
+
|
|
1
3
|
const logout = async () => {
|
|
2
4
|
const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
3
5
|
try {
|
|
4
|
-
|
|
5
|
-
// method: 'POST'
|
|
6
|
-
// });
|
|
7
|
-
const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
6
|
+
const res = await Fetch(`/api/lawfirm/app/auth/logout`, {
|
|
8
7
|
method: 'POST',
|
|
9
|
-
headers: { 'Content-Type': 'application/json' },
|
|
10
|
-
cache: 'no-cache',
|
|
11
8
|
credentials: 'include'
|
|
12
|
-
})
|
|
9
|
+
})
|
|
10
|
+
// const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
11
|
+
// method: 'POST',
|
|
12
|
+
// headers: { 'Content-Type': 'application/json' },
|
|
13
|
+
// cache: 'no-cache',
|
|
14
|
+
// credentials: 'include'
|
|
15
|
+
// }).then((res) => res.json())
|
|
13
16
|
if (res.result) {
|
|
14
17
|
const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
15
18
|
method: 'DELETE',
|
|
@@ -8,9 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
import { createLogoutLog } from '../_api/checkLogoutLog';
|
|
12
|
+
import checkThirdPartyCookie from '../_api/checkThirdPartyCookie';
|
|
11
13
|
// 로펌용
|
|
12
|
-
import { deleteToken } from '../_api/token';
|
|
14
|
+
import { deleteToken, getToken } from '../_api/token';
|
|
13
15
|
const Fetch = (url_1, ...args_1) => __awaiter(void 0, [url_1, ...args_1], void 0, function* (url, options = {}) {
|
|
16
|
+
if (url === '/api/lawfirm/app/auth/logout') {
|
|
17
|
+
const result = yield getToken();
|
|
18
|
+
const isCookie = yield checkThirdPartyCookie();
|
|
19
|
+
// console.log('isCookie', isCookie);
|
|
20
|
+
if (!isCookie) {
|
|
21
|
+
yield createLogoutLog();
|
|
22
|
+
// console.log('res', res);
|
|
23
|
+
}
|
|
24
|
+
const res = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: { 'Content-Type': 'application/json', 'Authorization': `${result || ''}` },
|
|
27
|
+
cache: 'no-cache',
|
|
28
|
+
credentials: 'include'
|
|
29
|
+
}).then((res) => res.json());
|
|
30
|
+
// console.log('res', res);
|
|
31
|
+
return res;
|
|
32
|
+
}
|
|
14
33
|
options = Object.assign(Object.assign({}, options), { credentials: 'include' });
|
|
15
34
|
options.headers = Object.assign(Object.assign({}, options.headers), { Accept: 'application/json;charset=UTF-8' });
|
|
16
35
|
if ((options === null || options === void 0 ? void 0 : options.method) === 'POST' && options.type !== 'form') {
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { createLogoutLog } from '../_api/checkLogoutLog';
|
|
3
|
+
import checkThirdPartyCookie from '../_api/checkThirdPartyCookie';
|
|
2
4
|
// 로펌용
|
|
3
5
|
|
|
4
|
-
import { deleteToken } from '../_api/token';
|
|
6
|
+
import { deleteToken, getToken } from '../_api/token';
|
|
5
7
|
|
|
6
8
|
const Fetch = async (url: string, options: any = {}) => {
|
|
9
|
+
|
|
10
|
+
if (url ==='/api/lawfirm/app/auth/logout') {
|
|
11
|
+
const result = await getToken();
|
|
12
|
+
const isCookie = await checkThirdPartyCookie();
|
|
13
|
+
// console.log('isCookie', isCookie);
|
|
14
|
+
if(!isCookie){
|
|
15
|
+
await createLogoutLog();
|
|
16
|
+
// console.log('res', res);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: { 'Content-Type': 'application/json', 'Authorization': `${result ||''}` },
|
|
22
|
+
cache: 'no-cache',
|
|
23
|
+
credentials: 'include'
|
|
24
|
+
}).then((res) => res.json())
|
|
25
|
+
// console.log('res', res);
|
|
26
|
+
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
7
29
|
options = {
|
|
8
30
|
...options,
|
|
9
31
|
credentials: 'include'
|