Skip to content

Commit

Permalink
try fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Nov 1, 2024
1 parent 2a31d66 commit d7a5858
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions modals/pop-up/StudyPreferenceDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import PickerRowButton from "../../components/molecules/PickerRowButton";
import BottomFlexDrawer, {
BottomFlexDrawerOptions,
} from "../../components/organisms/drawer/BottomFlexDrawer";
import { USER_LOCATION } from "../../constants/keys/localStorage";
import { USER_INFO } from "../../constants/keys/queryKeys";
import { useResetStudyQuery } from "../../hooks/custom/CustomHooks";
import { useToast } from "../../hooks/custom/CustomToast";
Expand All @@ -34,12 +33,9 @@ function StudyPreferenceDrawer({ setIsModal, handleClick }: StudyPreferenceDrawe
const { data: session } = useSession();
const toast = useToast();
const queryClient = useQueryClient();
const userLocation =
typeof window !== "undefined"
? (localStorage.getItem(USER_LOCATION) as ActiveLocation) || session?.user.location
: session?.user.location;

const resetStudy = useResetStudyQuery();
const [location, setLocation] = useState<ActiveLocation>(userLocation);
const [location, setLocation] = useState<ActiveLocation>(session?.user.location);

const [placeArr, setPlaceArr] = useState<StudyThumbnailCardProps[]>();
const [pickPreferences, setPickPreferences] = useState<{
Expand All @@ -66,8 +62,9 @@ function StudyPreferenceDrawer({ setIsModal, handleClick }: StudyPreferenceDrawe
});

useEffect(() => {
setLocation(userLocation);
}, [userLocation]);
if (!session) return;
setLocation(session?.user.location);
}, [session]);

const preference = userInfo?.studyPreference;
const userLocationDetail = userInfo.locationDetail;
Expand Down

0 comments on commit d7a5858

Please sign in to comment.