From 8c8393cad90e62e7c766048d7c8a1874a033508d Mon Sep 17 00:00:00 2001 From: 0ev Date: Mon, 3 Apr 2023 23:08:02 +0900 Subject: [PATCH 01/43] Fix: weird text when no userId --- src/components/Skeleton/index.tsx | 17 +++++++++++++---- src/pages/Home/InfoSection.tsx | 6 +++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/Skeleton/index.tsx b/src/components/Skeleton/index.tsx index 719da9d6b..f91bf26e2 100644 --- a/src/components/Skeleton/index.tsx +++ b/src/components/Skeleton/index.tsx @@ -1,5 +1,5 @@ import { ReactNode, useEffect, useState } from "react"; -import { Redirect, useLocation } from "react-router-dom"; +import { useLocation, Redirect } from "react-router-dom"; import { useAxios } from "hooks/useTaxiAPI"; @@ -17,7 +17,6 @@ import myRoomAtom from "atoms/myRoom"; import notificationOptionsAtom from "atoms/notificationOptions"; import taxiLocationAtom from "atoms/taxiLocation"; import { useRecoilState, useRecoilValue, useSetRecoilState } from "recoil"; - type ContainerProps = { children: ReactNode; }; @@ -118,7 +117,15 @@ const Skeleton = ({ children }: SkeletonProps) => { ); } - if (!userId && !pathname.startsWith("/login")) { + // when pathname is /, /home, /search, dont redirect + if ( + !userId && + !pathname.startsWith("/login") && + pathname !== "/" && + !pathname.startsWith("/search") && + !pathname.startsWith("/home") && + !pathname.startsWith("/logout") + ) { return ( ); @@ -140,7 +147,9 @@ const Skeleton = ({ children }: SkeletonProps) => { {children}