Skip to content

Commit

Permalink
Merge pull request #100 from LikelionUniv/fix/hackathon-loginNav-fix
Browse files Browse the repository at this point in the history
Fix/hackathon login nav fix
  • Loading branch information
eastfilmm authored Jul 3, 2024
2 parents 5c599c4 + b62cbea commit e08d4c5
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/api/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const requestIdtoken = async (
provider: string | undefined,
) => {
return await axiosInstance
.get(`/api/v1/auth/${provider}/idToken/local?code=${authorizationCode}`)
.get(`/api/v1/auth/${provider}/idtoken?code=${authorizationCode}`)
.then(response => {
localStorage.setItem('idtoken', response.data.data.idToken);
return response.data.data.idToken;
Expand Down
6 changes: 6 additions & 0 deletions src/pages/landing/components/Information.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ export const SwiperWrapper = styled.div`
overflow-x: hidden;
padding-bottom: 165px;
@media (max-width: 767px) {
padding-bottom: 120px;
}
@media (max-width: 360px) {
padding-bottom: 60px;
}
.swiper-container {
width: 984px !important;
@media (max-width: 1280px) {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/landing/components/hackathon/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ const MoreTitle = styled.div`
@media (max-width: 767px) {
font-size: 20px;
text-align: center;
}
@media (max-width: 360px) {
font-size: 20px;
text-align: center;
}
`;

Expand Down Expand Up @@ -101,12 +103,14 @@ const MoreBtn = styled.div`
@media (max-width: 767px) {
/* width: clamp(360px, 3vw, 523px); */
width: 300px;
width: 320px;
height: 48px;
font-size: 16px;
}
@media (max-width: 360px) {
width: clamp(250px, 2vw, 320px);
height: 48px;
font-size: 16px;
}
&:hover {
color: #ff7710;
Expand Down
22 changes: 8 additions & 14 deletions src/pages/landing/components/hackathon/MainInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useNavigate } from 'react-router-dom';
import { useEffect } from 'react';
import { styled } from 'styled-components';
import HackathonPart from './HackathonPart';
import title from '../../../../img/landing/title.png';
Expand All @@ -13,18 +11,6 @@ import check_g from '../../../../img/landing/check_g.png';
import check_r from '../../../../img/landing/check_r.png';

const MainInfo = () => {
const navigate = useNavigate();

useEffect(() => {
const accessToken = localStorage.getItem('access_token');
const nav = sessionStorage.getItem('nav');

if (nav === 'hackathons' && accessToken) {
navigate('/hackathons');
sessionStorage.removeItem('nav');
}
}, [navigate]);

return (
<MainWrapper>
<FirstWrapper>
Expand Down Expand Up @@ -127,6 +113,14 @@ const Container = styled.div`
align-items: center;
width: 100%;
max-width: 1200px;
@media (max-width: 767px) {
width: 80%;
}
@media (max-width: 360px) {
width: 90%;
}
`;

const TitleImg = styled.img`
Expand Down
24 changes: 20 additions & 4 deletions src/pages/landing/components/hackathon/More.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,29 @@ const MoreTitle = styled.div`
line-height: 150%; /* 48px */
@media (max-width: 767px) {
font-size: 30px;
width: 80%;
margin-bottom: 16px;
text-align: center;
/* Title/40_Bold */
font-family: Pretendard;
font-size: clamp(16px, 4vw, 40px);
font-style: normal;
font-weight: 700;
line-height: 150%;
}
@media (max-width: 360px) {
font-size: 16px;
text-align: center;
width: 90%;
margin-bottom: 8px;
text-align: center;
/* Title/16_Bold */
font-family: Pretendard;
font-size: 16px;
font-style: normal;
font-weight: 700;
line-height: 150%;
}
`;

Expand All @@ -102,12 +116,14 @@ const MoreBtn = styled.div`
line-height: 150%; /* 30px */
@media (max-width: 767px) {
width: 300px;
width: clamp(320px, 2vw, 530px);
height: 48px;
font-size: 16px;
}
@media (max-width: 360px) {
width: clamp(250px, 2vw, 320px);
height: 48px;
font-size: 16px;
}
&:hover {
background-color: #d1d4d8;
Expand Down
6 changes: 6 additions & 0 deletions src/pages/login/components/Redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ export const Redirect = () => {
});

useEffect(() => {
const accessToken = localStorage.getItem('access_token');
const nav = sessionStorage.getItem('nav');

if (error) {
navigate('/login');
} else if (data === null) {
navigate(`/signup/${provider}`);
} else if (nav === 'hackathons' && accessToken) {
navigate('/hackathons');
sessionStorage.removeItem('nav');
} else if (data) {
navigate('/');
}
Expand Down

0 comments on commit e08d4c5

Please sign in to comment.