Skip to content

Commit

Permalink
Merge pull request #72 from Teammanagers/develop
Browse files Browse the repository at this point in the history
이슈 수정
  • Loading branch information
Low-ProFiles authored Aug 23, 2024
2 parents 820dda5 + 24357cc commit e0cff94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/components/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import KakaoLogo from '@assets/login/kakao-logo.svg';
import NaverLogo from '@assets/login/naver-logo.svg';
import GoogleLogo from '@assets/login/google-logo.svg';
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';

const Login = () => {
const navigate = useNavigate();
const location = useLocation();
const [isRouteByEvent, setIsRouteByEvent] = useState<boolean>(false);
const handleKakaoButtonClick = () => {
window.location.href =
Expand All @@ -31,14 +32,14 @@ const Login = () => {
const token = localStorage.getItem('accessToken');
const isNewUser = !!localStorage.getItem('isNewUser');

if (token && isNewUser) {
if (token && !!isNewUser) {
navigate('/signup');
}

if (token && !isNewUser) {
navigate('/team');
}
}, [isRouteByEvent]);
}, [isRouteByEvent, location]);

return (
<OnBoardingTextDiv>
Expand Down
3 changes: 2 additions & 1 deletion src/components/sidebar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const SideBar = () => {
const navigate = useNavigate();
const location = useLocation();

const { result } = useGetAlarmList(Number(localStorage.getItem('teamId')));
const teamId = Number(localStorage.getItem('teamId'));
const { result } = teamId && useGetAlarmList(teamId);

const handleNavigate = (path: string) => {
navigate(path);
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/team/useCreateTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ export const useCreateTeam = (): UseMutationResult<
> => {
const navigate = useNavigate();
const mutation = useMutation({
mutationFn: createTeam, // 올바른 함수 전달
mutationFn: createTeam,
onSuccess: (data) => {
console.log(data.result, 'ㅎㅇ');
navigate('/team/share', {
state: {
teamCode: data.result.teamCode,
Expand Down

0 comments on commit e0cff94

Please sign in to comment.