@daeryun/dr_components 1.1.23 → 1.1.24

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.
@@ -19,7 +19,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
19
19
  const router = useRouter();
20
20
  const pathName = usePathname();
21
21
  const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
22
- const CHECK_ROUTE = ['/mycase', '/mypage', '/login'];
22
+ const CHECK_ROUTE = ['/', '/mycase', '/mypage', '/login'];
23
23
  /** 기본 게스트 유저 설정 */
24
24
  const setGuestUser = () => {
25
25
  const guestUser = { email: '', name: '', provider: '', isLogin: false };
@@ -190,7 +190,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }) => {
190
190
  });
191
191
  useEffect(() => {
192
192
  if (pathName) {
193
- const routeCheck = CHECK_ROUTE.some(route => pathName.startsWith(route));
193
+ const routeCheck = pathName === '/' || CHECK_ROUTE.some(route => pathName && pathName.startsWith(route));
194
194
  if (routeCheck) {
195
195
  initializeUser();
196
196
  handlePageTransitionCheck();
@@ -18,7 +18,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
18
18
  const router = useRouter();
19
19
  const pathName = usePathname();
20
20
  const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
21
- const CHECK_ROUTE = ['/mycase', '/mypage', '/login'];
21
+ const CHECK_ROUTE = ['/', '/mycase', '/mypage', '/login'];
22
22
 
23
23
  /** 기본 게스트 유저 설정 */
24
24
  const setGuestUser = () => {
@@ -202,7 +202,7 @@ const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
202
202
 
203
203
  useEffect(() => {
204
204
  if (pathName) {
205
- const routeCheck = CHECK_ROUTE.some(route => pathName.startsWith(route));
205
+ const routeCheck = pathName === '/' || CHECK_ROUTE.some(route => pathName && pathName.startsWith(route));
206
206
  if (routeCheck) {
207
207
  initializeUser();
208
208
  handlePageTransitionCheck();
@@ -80,7 +80,7 @@ const useAppLoginDetect = (userInfo, pathname, setUserInfo) => {
80
80
  const isCookie = yield checkThirdPartyCookie();
81
81
  yield checkAppLoginDetect(userInfo, setUserInfo, isCookie);
82
82
  });
83
- const routeCheck = CHECK_ROUTE.some(route => pathname.startsWith(route));
83
+ const routeCheck = pathname === '/' || CHECK_ROUTE.some(route => pathname.startsWith(route));
84
84
  if (routeCheck) {
85
85
  checkLogin();
86
86
  }
@@ -75,18 +75,17 @@ const useAppLoginDetect = (
75
75
  setUserInfo: React.Dispatch<React.SetStateAction<ILoginInfo>>
76
76
  ) => {
77
77
  useEffect(() => {
78
- if(pathname){
78
+ if (pathname) {
79
79
  const checkLogin = async () => {
80
80
  const isCookie = await checkThirdPartyCookie();
81
81
  await checkAppLoginDetect(userInfo, setUserInfo, isCookie);
82
82
  };
83
- const routeCheck = CHECK_ROUTE.some(route => pathname.startsWith(route));
84
-
83
+ const routeCheck = pathname === '/' || CHECK_ROUTE.some(route => pathname.startsWith(route));
84
+
85
85
  if (routeCheck) {
86
86
  checkLogin();
87
87
  }
88
88
  }
89
-
90
89
  }, [userInfo, pathname]);
91
90
  };
92
91