@daeryun/dr_components 0.3.92 → 0.3.94
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/index.js +1 -1
- package/dist/components/index.ts +1 -1
- package/dist/components/page/Login/_api/_server/appLoginInfo.js +11 -8
- package/dist/components/page/Login/_api/_server/appLoginInfo.ts +15 -8
- package/dist/components/page/Login/_api/fetchAuthCallback.d.ts +1 -1
- package/dist/components/page/Login/_api/fetchAuthCallback.js +2 -2
- package/dist/components/page/Login/_api/fetchAuthCallback.ts +5 -2
- package/dist/components/page/Login/_api/fetchUserData.d.ts +1 -1
- package/dist/components/page/Login/_api/fetchUserData.js +2 -2
- package/dist/components/page/Login/_api/fetchUserData.ts +5 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -18,4 +18,4 @@ export { default as SeoStrength } from './Seo/SeoStrength';
|
|
|
18
18
|
export { default as Personal } from './page/Login/Personal';
|
|
19
19
|
export { default as Withdraw } from './page/Login/Withdraw';
|
|
20
20
|
export { default as LoginShareCheckContainer } from './page/Login/LoginShareCheckContainer';
|
|
21
|
-
export { default as
|
|
21
|
+
export { default as appLoginInfo } from './page/Login/_api/_server/appLoginInfo';
|
package/dist/components/index.ts
CHANGED
|
@@ -18,4 +18,4 @@ export { default as SeoStrength } from './Seo/SeoStrength';
|
|
|
18
18
|
export { default as Personal } from './page/Login/Personal';
|
|
19
19
|
export { default as Withdraw } from './page/Login/Withdraw';
|
|
20
20
|
export { default as LoginShareCheckContainer } from './page/Login/LoginShareCheckContainer';
|
|
21
|
-
export { default as
|
|
21
|
+
export { default as appLoginInfo } from './page/Login/_api/_server/appLoginInfo';
|
|
@@ -11,29 +11,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import { checkThirdPartyCookie } from '../checkThirdPartyCookie';
|
|
12
12
|
import { fetchAuthCallback } from '../fetchAuthCallback';
|
|
13
13
|
import { fetchUserData } from '../fetchUserData';
|
|
14
|
+
import { cookies } from 'next/headers';
|
|
14
15
|
export const loginInfo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
16
|
const isCookieAllowed = yield checkThirdPartyCookie();
|
|
17
|
+
const cookieStore = cookies();
|
|
18
|
+
const cookieHeader = cookieStore.toString();
|
|
16
19
|
// 쿠키 허용
|
|
17
20
|
if (isCookieAllowed) {
|
|
18
21
|
// 이지스에 로그인 쿠키 있는지 확인
|
|
19
|
-
const result = yield fetchAuthCallback();
|
|
22
|
+
const result = yield fetchAuthCallback(cookieHeader);
|
|
20
23
|
// 이지스에 쿠키가 존재 => 이 유저는 로그인한 유저
|
|
21
24
|
if (result.result && result.jwt) {
|
|
22
25
|
// next 에 이미 쿠키가 있는지 확인
|
|
23
26
|
const tokenCheckResult = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
24
27
|
method: 'GET',
|
|
25
|
-
headers: { 'Content-Type': 'application/json' },
|
|
28
|
+
headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
|
|
26
29
|
credentials: 'include'
|
|
27
30
|
}).then(res => res.json());
|
|
28
31
|
// 이미 있으므로 이 유저는 로그인 유저임
|
|
29
32
|
if (tokenCheckResult.token) {
|
|
30
|
-
return yield fetchUserData();
|
|
33
|
+
return yield fetchUserData(cookieHeader);
|
|
31
34
|
}
|
|
32
35
|
// 쿠키가 없어서 만들고 나서 요청
|
|
33
36
|
else {
|
|
34
|
-
const createResult = yield createTokenAndFetchUser(result.jwt);
|
|
37
|
+
const createResult = yield createTokenAndFetchUser(result.jwt, cookieHeader);
|
|
35
38
|
if (createResult) {
|
|
36
|
-
return yield fetchUserData();
|
|
39
|
+
return yield fetchUserData(cookieHeader);
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
39
42
|
return { isLogin: false, provider: '', name: '', email: '' };
|
|
@@ -47,15 +50,15 @@ export const loginInfo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
49
52
|
// 이거는 계속 날려주면 됨
|
|
50
|
-
return yield fetchUserData();
|
|
53
|
+
return yield fetchUserData(cookieHeader);
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
export default loginInfo;
|
|
54
|
-
const createTokenAndFetchUser = (jwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
const createTokenAndFetchUser = (jwt, cookies) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
58
|
const createTokenResult = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
56
59
|
body: JSON.stringify({ jwt }),
|
|
57
60
|
method: 'POST',
|
|
58
|
-
headers: { 'Content-Type': 'application/json' },
|
|
61
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, (cookies !== '' ? { Cookie: cookies } : {})),
|
|
59
62
|
credentials: 'include'
|
|
60
63
|
}).then(res => res.json());
|
|
61
64
|
return createTokenResult.token;
|
|
@@ -3,30 +3,34 @@ import { checkThirdPartyCookie } from '../checkThirdPartyCookie';
|
|
|
3
3
|
import { fetchAuthCallback } from '../fetchAuthCallback';
|
|
4
4
|
import { fetchUserData } from '../fetchUserData';
|
|
5
5
|
import { ILoginInfo } from '../../_types/login';
|
|
6
|
+
import { cookies } from 'next/headers';
|
|
6
7
|
|
|
7
8
|
export const loginInfo = async (): Promise<ILoginInfo> => {
|
|
8
9
|
const isCookieAllowed = await checkThirdPartyCookie();
|
|
10
|
+
const cookieStore = cookies();
|
|
11
|
+
const cookieHeader = cookieStore.toString();
|
|
9
12
|
// 쿠키 허용
|
|
10
13
|
if (isCookieAllowed) {
|
|
11
14
|
// 이지스에 로그인 쿠키 있는지 확인
|
|
12
|
-
const result = await fetchAuthCallback();
|
|
15
|
+
const result = await fetchAuthCallback(cookieHeader);
|
|
16
|
+
|
|
13
17
|
// 이지스에 쿠키가 존재 => 이 유저는 로그인한 유저
|
|
14
18
|
if (result.result && result.jwt) {
|
|
15
19
|
// next 에 이미 쿠키가 있는지 확인
|
|
16
20
|
const tokenCheckResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
17
21
|
method: 'GET',
|
|
18
|
-
headers: { 'Content-Type': 'application/json' },
|
|
22
|
+
headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
|
|
19
23
|
credentials: 'include'
|
|
20
24
|
}).then(res => res.json());
|
|
21
25
|
// 이미 있으므로 이 유저는 로그인 유저임
|
|
22
26
|
if (tokenCheckResult.token) {
|
|
23
|
-
return await fetchUserData();
|
|
27
|
+
return await fetchUserData(cookieHeader);
|
|
24
28
|
}
|
|
25
29
|
// 쿠키가 없어서 만들고 나서 요청
|
|
26
30
|
else {
|
|
27
|
-
const createResult = await createTokenAndFetchUser(result.jwt);
|
|
31
|
+
const createResult = await createTokenAndFetchUser(result.jwt, cookieHeader);
|
|
28
32
|
if (createResult) {
|
|
29
|
-
return await fetchUserData();
|
|
33
|
+
return await fetchUserData(cookieHeader);
|
|
30
34
|
} else {
|
|
31
35
|
return { isLogin: false, provider: '', name: '', email: '' };
|
|
32
36
|
}
|
|
@@ -37,17 +41,20 @@ export const loginInfo = async (): Promise<ILoginInfo> => {
|
|
|
37
41
|
}
|
|
38
42
|
} else {
|
|
39
43
|
// 이거는 계속 날려주면 됨
|
|
40
|
-
return await fetchUserData();
|
|
44
|
+
return await fetchUserData(cookieHeader);
|
|
41
45
|
}
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
export default loginInfo;
|
|
45
49
|
|
|
46
|
-
const createTokenAndFetchUser = async (jwt: string) => {
|
|
50
|
+
const createTokenAndFetchUser = async (jwt: string, cookies?: string) => {
|
|
47
51
|
const createTokenResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
48
52
|
body: JSON.stringify({ jwt }),
|
|
49
53
|
method: 'POST',
|
|
50
|
-
headers: {
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
...(cookies !== '' ? { Cookie: cookies } : {})
|
|
57
|
+
},
|
|
51
58
|
credentials: 'include'
|
|
52
59
|
}).then(res => res.json());
|
|
53
60
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** 로그인 콜백 처리 */
|
|
2
|
-
export declare const fetchAuthCallback: () => Promise<any>;
|
|
2
|
+
export declare const fetchAuthCallback: (cookies?: string) => Promise<any>;
|
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
/** 로그인 콜백 처리 */
|
|
11
|
-
export const fetchAuthCallback = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
export const fetchAuthCallback = (cookies) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
return yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/callback`, {
|
|
13
13
|
method: 'GET',
|
|
14
|
-
headers: { 'Content-Type': 'application/json' },
|
|
14
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, (cookies !== '' ? { Cookie: cookies } : {})),
|
|
15
15
|
cache: 'no-cache',
|
|
16
16
|
credentials: 'include'
|
|
17
17
|
}).then(res => res.json());
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/** 로그인 콜백 처리 */
|
|
2
|
-
export const fetchAuthCallback = async () => {
|
|
2
|
+
export const fetchAuthCallback = async (cookies?: string) => {
|
|
3
3
|
return await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/callback`, {
|
|
4
4
|
method: 'GET',
|
|
5
|
-
headers: {
|
|
5
|
+
headers: {
|
|
6
|
+
'Content-Type': 'application/json',
|
|
7
|
+
...(cookies !== '' ? { Cookie: cookies } : {})
|
|
8
|
+
},
|
|
6
9
|
cache: 'no-cache',
|
|
7
10
|
credentials: 'include'
|
|
8
11
|
}).then(res => res.json());
|
|
@@ -8,11 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
/** 쿠키 허용 시 유저 정보 조회 */
|
|
11
|
-
export const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
export const fetchUserData = (cookies) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/lawfirm/app/user`, {
|
|
14
14
|
method: 'GET',
|
|
15
|
-
headers: { 'Content-Type': 'application/json' },
|
|
15
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, (cookies !== '' ? { Cookie: cookies } : {})),
|
|
16
16
|
cache: 'no-cache',
|
|
17
17
|
credentials: 'include'
|
|
18
18
|
}).then(res => res.json());
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ILoginInfo } from '../_types/login';
|
|
2
2
|
|
|
3
3
|
/** 쿠키 허용 시 유저 정보 조회 */
|
|
4
|
-
export const fetchUserData = async (): Promise<ILoginInfo> => {
|
|
4
|
+
export const fetchUserData = async (cookies?: string): Promise<ILoginInfo> => {
|
|
5
5
|
const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/lawfirm/app/user`, {
|
|
6
6
|
method: 'GET',
|
|
7
|
-
headers: {
|
|
7
|
+
headers: {
|
|
8
|
+
'Content-Type': 'application/json',
|
|
9
|
+
...(cookies !== '' ? { Cookie: cookies } : {})
|
|
10
|
+
},
|
|
8
11
|
cache: 'no-cache',
|
|
9
12
|
credentials: 'include'
|
|
10
13
|
}).then(res => res.json());
|