@daeryun/dr_components 0.3.61 → 0.3.63
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/LoginComp/LoginContainer.jsx +1 -1
- package/dist/components/page/Login/LoginComp/LoginContainer.tsx +1 -1
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +17 -1
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +20 -3
- package/dist/components/page/Login/LoginShareCheckContainer.jsx +8 -1
- package/dist/components/page/Login/LoginShareCheckContainer.tsx +8 -1
- package/dist/components/page/Login/Personal.jsx +1 -1
- package/dist/components/page/Login/Personal.tsx +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
|
|
|
31
31
|
}
|
|
32
32
|
}, [pathName]);
|
|
33
33
|
const handleLoginClick = (type) => {
|
|
34
|
-
const loginUrl = `https://oauth.daeryunlaw.com/login/${type}?clientKey=${clientKey}&${process.env.NODE_ENV === 'production' ?
|
|
34
|
+
const loginUrl = `https://oauth.daeryunlaw.com/login/${type}?clientKey=${clientKey}&${process.env.NODE_ENV === 'production' ? `state=${state}` : ''}`;
|
|
35
35
|
redirectWithNoReferrer(loginUrl);
|
|
36
36
|
};
|
|
37
37
|
const loginProvider = [
|
|
@@ -44,7 +44,7 @@ const LoginContainer = ({
|
|
|
44
44
|
|
|
45
45
|
const handleLoginClick = (type: string) => {
|
|
46
46
|
const loginUrl = `https://oauth.daeryunlaw.com/login/${type}?clientKey=${clientKey}&${
|
|
47
|
-
process.env.NODE_ENV === 'production' ?
|
|
47
|
+
process.env.NODE_ENV === 'production' ? `state=${state}` : ''
|
|
48
48
|
}`;
|
|
49
49
|
redirectWithNoReferrer(loginUrl);
|
|
50
50
|
};
|
|
@@ -8,7 +8,7 @@ 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 React, { useCallback, useEffect, useRef, useState
|
|
11
|
+
import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react';
|
|
12
12
|
import { useRouter } from 'next/navigation';
|
|
13
13
|
import { formatPhoneNumber, formatTime, getCookie, getNameValue, getPhoneValue, onlyNumberFilter } from '../../../../lib';
|
|
14
14
|
import { deleteToken, getToken } from '../_api/token';
|
|
@@ -26,6 +26,9 @@ import RequiredCheckBox from './Sign/RequiredCheckBox';
|
|
|
26
26
|
import LButton from './LButton';
|
|
27
27
|
import LInput from './Linput';
|
|
28
28
|
import Image from 'next/image';
|
|
29
|
+
import { useQuery } from '@tanstack/react-query/build/modern/index';
|
|
30
|
+
import Fetch from '../_fetch/fetch';
|
|
31
|
+
import { Loader } from '../../../index';
|
|
29
32
|
const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, setUser }) => {
|
|
30
33
|
const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
31
34
|
const router = useRouter();
|
|
@@ -35,6 +38,16 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
35
38
|
email: '',
|
|
36
39
|
provider: ''
|
|
37
40
|
});
|
|
41
|
+
const { data: termData, status: termDataStatus } = useQuery({
|
|
42
|
+
queryKey: ['code', 'children', '10'],
|
|
43
|
+
queryFn: () => {
|
|
44
|
+
return Fetch(`/api/lawfirm/app/code/children?parentCode=10`, {
|
|
45
|
+
method: 'GET'
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
staleTime: 1000 * 60 * 5
|
|
49
|
+
});
|
|
50
|
+
console.log('termData', termData);
|
|
38
51
|
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
39
52
|
const [requiredTermItems, setRequiredTermItems] = useState([
|
|
40
53
|
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true },
|
|
@@ -402,6 +415,9 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
402
415
|
setIsModal(false);
|
|
403
416
|
setModalObj({ title: '', subTitle: '', key: '' });
|
|
404
417
|
};
|
|
418
|
+
if (termDataStatus !== 'success') {
|
|
419
|
+
return <Loader fullScreen/>;
|
|
420
|
+
}
|
|
405
421
|
return (<Suspense>
|
|
406
422
|
<section className={layoutClassName}>
|
|
407
423
|
<PageWrapper>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React, { FormEvent, useCallback, useEffect, useRef, useState
|
|
3
|
-
import {
|
|
2
|
+
import React, { FormEvent, Suspense, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useRouter } from 'next/navigation';
|
|
4
4
|
import {
|
|
5
5
|
formatPhoneNumber,
|
|
6
6
|
formatTime,
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
onlyNumberFilter
|
|
11
11
|
} from '../../../../lib';
|
|
12
12
|
import { deleteToken, getToken } from '../_api/token';
|
|
13
|
-
import { RecoilState, useSetRecoilState } from 'recoil';
|
|
14
13
|
import { jwtDecode } from 'jwt-decode';
|
|
15
14
|
import { sendNumber } from '../_api/sendNumber';
|
|
16
15
|
import { confirmNumber } from '../_api/confirmNumber';
|
|
@@ -26,6 +25,9 @@ import LButton from './LButton';
|
|
|
26
25
|
import LInput from './Linput';
|
|
27
26
|
import Image from 'next/image';
|
|
28
27
|
import { ILoginInfo } from '../_types/login';
|
|
28
|
+
import { useQuery } from '@tanstack/react-query/build/modern/index';
|
|
29
|
+
import Fetch from '../_fetch/fetch';
|
|
30
|
+
import { Loader } from '../../../index';
|
|
29
31
|
|
|
30
32
|
interface IUser {
|
|
31
33
|
name: string;
|
|
@@ -87,6 +89,17 @@ const SignContainer = ({
|
|
|
87
89
|
provider: ''
|
|
88
90
|
});
|
|
89
91
|
|
|
92
|
+
const { data: termData, status: termDataStatus } = useQuery({
|
|
93
|
+
queryKey: ['code', 'children', '10'],
|
|
94
|
+
queryFn: () => {
|
|
95
|
+
return Fetch(`/api/lawfirm/app/code/children?parentCode=10`, {
|
|
96
|
+
method: 'GET'
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
staleTime: 1000 * 60 * 5
|
|
100
|
+
});
|
|
101
|
+
console.log('termData', termData);
|
|
102
|
+
|
|
90
103
|
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
91
104
|
|
|
92
105
|
const [requiredTermItems, setRequiredTermItems] = useState<IRequiredCheckItem[]>([
|
|
@@ -513,6 +526,10 @@ const SignContainer = ({
|
|
|
513
526
|
setModalObj({ title: '', subTitle: '', key: '' });
|
|
514
527
|
};
|
|
515
528
|
|
|
529
|
+
if (termDataStatus !== 'success') {
|
|
530
|
+
return <Loader fullScreen />;
|
|
531
|
+
}
|
|
532
|
+
|
|
516
533
|
return (
|
|
517
534
|
<Suspense>
|
|
518
535
|
<section className={layoutClassName}>
|
|
@@ -14,12 +14,14 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const initializeUser = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const storedUser = sessionStorage.getItem(SESSION_KEY);
|
|
17
|
+
console.log('storedUser', storedUser);
|
|
17
18
|
if (storedUser) {
|
|
18
19
|
try {
|
|
19
20
|
const parsedUser = JSON.parse(storedUser);
|
|
20
21
|
setUserInfo(parsedUser);
|
|
21
22
|
if (parsedUser.isLogin) {
|
|
22
23
|
const userData = yield fetchUserData();
|
|
24
|
+
console.log('userData', userData);
|
|
23
25
|
if (userData) {
|
|
24
26
|
setUserInfo(userData);
|
|
25
27
|
}
|
|
@@ -34,7 +36,9 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
|
|
|
34
36
|
sessionStorage.removeItem(SESSION_KEY);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
else {
|
|
40
|
+
yield check();
|
|
41
|
+
}
|
|
38
42
|
});
|
|
39
43
|
const setGuestUser = () => {
|
|
40
44
|
const guestUser = { email: '', name: '', isLogin: false };
|
|
@@ -49,12 +53,14 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
|
|
|
49
53
|
cache: 'no-cache',
|
|
50
54
|
credentials: 'include'
|
|
51
55
|
}).then(res => res.json());
|
|
56
|
+
console.log(`check result`, result);
|
|
52
57
|
if (result.result && result.jwt) {
|
|
53
58
|
const tokenCheckResult = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
54
59
|
method: 'GET',
|
|
55
60
|
headers: { 'Content-Type': 'application/json' },
|
|
56
61
|
credentials: 'include'
|
|
57
62
|
}).then(obj => obj.json());
|
|
63
|
+
console.log('get next toekn check', tokenCheckResult);
|
|
58
64
|
if (tokenCheckResult.token) {
|
|
59
65
|
const userData = yield fetchUserData();
|
|
60
66
|
if (userData) {
|
|
@@ -72,6 +78,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
|
|
|
72
78
|
headers: { 'Content-Type': 'application/json' },
|
|
73
79
|
credentials: 'include'
|
|
74
80
|
}).then(obj => obj.json());
|
|
81
|
+
console.log('POST next toekn check', tokenCheckResult);
|
|
75
82
|
if (createTokenResult.token) {
|
|
76
83
|
const userData = yield fetchUserData();
|
|
77
84
|
if (userData) {
|
|
@@ -18,6 +18,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const initializeUser = async () => {
|
|
20
20
|
const storedUser = sessionStorage.getItem(SESSION_KEY);
|
|
21
|
+
console.log('storedUser', storedUser);
|
|
21
22
|
|
|
22
23
|
if (storedUser) {
|
|
23
24
|
try {
|
|
@@ -26,6 +27,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
26
27
|
|
|
27
28
|
if (parsedUser.isLogin) {
|
|
28
29
|
const userData = await fetchUserData();
|
|
30
|
+
console.log('userData', userData);
|
|
29
31
|
if (userData) {
|
|
30
32
|
setUserInfo(userData);
|
|
31
33
|
} else {
|
|
@@ -37,8 +39,9 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
37
39
|
console.error('Failed to parse stored user data', e);
|
|
38
40
|
sessionStorage.removeItem(SESSION_KEY);
|
|
39
41
|
}
|
|
42
|
+
} else {
|
|
43
|
+
await check();
|
|
40
44
|
}
|
|
41
|
-
await check();
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
const setGuestUser = () => {
|
|
@@ -55,6 +58,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
55
58
|
cache: 'no-cache',
|
|
56
59
|
credentials: 'include'
|
|
57
60
|
}).then(res => res.json());
|
|
61
|
+
console.log(`check result`, result);
|
|
58
62
|
|
|
59
63
|
if (result.result && result.jwt) {
|
|
60
64
|
const tokenCheckResult = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
|
|
@@ -62,6 +66,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
62
66
|
headers: { 'Content-Type': 'application/json' },
|
|
63
67
|
credentials: 'include'
|
|
64
68
|
}).then(obj => obj.json());
|
|
69
|
+
console.log('get next toekn check', tokenCheckResult);
|
|
65
70
|
|
|
66
71
|
if (tokenCheckResult.token) {
|
|
67
72
|
const userData = await fetchUserData();
|
|
@@ -82,6 +87,8 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
|
|
|
82
87
|
}
|
|
83
88
|
).then(obj => obj.json());
|
|
84
89
|
|
|
90
|
+
console.log('POST next toekn check', tokenCheckResult);
|
|
91
|
+
|
|
85
92
|
if (createTokenResult.token) {
|
|
86
93
|
const userData = await fetchUserData();
|
|
87
94
|
if (userData) {
|
|
@@ -189,7 +189,7 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
189
189
|
useEffect(() => {
|
|
190
190
|
if (userData) {
|
|
191
191
|
setUserObj(prev => (Object.assign(Object.assign({}, prev), { email: userData.data.email, name: userData.data.name, provider: userData.data.provider, phoneNumber: onlyNumberFilter(userData.data.phone_number) })));
|
|
192
|
-
setUserValidObj(prev => (Object.assign(Object.assign({}, prev), { nameValid: getNameValue(userData.data.name).isValid })));
|
|
192
|
+
setUserValidObj(prev => (Object.assign(Object.assign({}, prev), { phoneNumberValid: getPhoneValue(onlyNumberFilter(userData.data.phone_number)).isValid, nameValid: getNameValue(userData.data.name).isValid })));
|
|
193
193
|
}
|
|
194
194
|
}, [userData]);
|
|
195
195
|
const timeChange = useCallback(() => {
|