Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] 로그인 로직 수정 및 미흡한 API 연결 수정 #78

Merged
merged 21 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4ee60fa
refactor: 토큰 관리 로직 수정 (#77)
AAminha Jun 3, 2024
2144f44
design: 80% 적용 (#77)
AAminha Jun 3, 2024
b193bb5
fix: 푸터 스타일 오류 수정 및 하단 사이트 이동 방식 수정 (#77)
AAminha Jun 4, 2024
16ec99c
fix: 네비게이션 디자인 수정 및 마이페이지 연결 (#77)
AAminha Jun 4, 2024
032e4d6
fix: 토큰 관리 방식 및 라우팅 제한 방식 수정 (#77)
AAminha Jun 4, 2024
45878b5
fix: 프로그램 링크 이동 방식 수정 (#77)
AAminha Jun 4, 2024
4e87801
design: 로그인 페이지 & 온보딩 페이지 디자인 수정 (#77)
AAminha Jun 4, 2024
a17f19d
fix: 마이페이지 구조 및 디자인 수정 (#77)
AAminha Jun 4, 2024
713b3c1
fix: 브랜드 관리 뷰 수정 (#77)
AAminha Jun 4, 2024
a0bdcb5
feat: 마이페이지 환경설정 부분 수정 및 TopNavigation 높이 수정 (#77)
AAminha Jun 5, 2024
f72065b
fix: 자기이해 홈에서 Discover 결과뷰 수정 및 api 오류 수정 (#77)
AAminha Jun 5, 2024
eb6737a
fix: styled-components 에러 수정 (#77)
AAminha Jun 5, 2024
06ea1e9
refactor: Define 테스트 페이지 리팩토링 (#77)
AAminha Jun 5, 2024
ff0babc
fix: Define 테스트 중 진행 중인 페이지로 이동하는 로직 오류 수정 (#77)
AAminha Jun 7, 2024
6a82900
fix: Discover 결과 페이지 조회 로직 수정 (#77)
AAminha Jun 7, 2024
ce74916
fix: 전시회를 위해 임시 라우팅 (#77)
AAminha Jun 7, 2024
905399c
fix: Discover 조회 방식 수정 (#77)
AAminha Jun 7, 2024
40d8f2c
fix: Discover 채팅 내용 중 줄바꿈은 다른 말풍선으로 보이도록 수정 (#77)
AAminha Jun 7, 2024
980482e
refactor: 챗봇 로직 리팩토링 (#77)
AAminha Jun 7, 2024
d7c7a7b
Merge branch 'develop' of https://github.com/KUSITMS-29th-TEAM-D/Fron…
AAminha Jun 7, 2024
4cca9b5
design: 테스트는 zoom 기본으로 수정 (#77)
AAminha Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions src/apis/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios, { AxiosInstance } from 'axios';

import { authService } from '@/services/AuthService';
import { userService } from '@/services/UserService';
import { tokenService } from '@/services/TokenService';

export const noAuthClient: AxiosInstance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
Expand All @@ -14,30 +13,23 @@ export const authClient: AxiosInstance = axios.create({
});

authClient.interceptors.request.use((config) => {
if (userService.getUserNickname() === '') {
const registerToken = authService.getRegisterToken();
if (registerToken !== null && registerToken !== undefined) {
config.headers['Authorization'] = `Bearer ${registerToken}`;
} else {
window.alert('로그인이 필요합니다.');
authService.onLogout();
}
}

config.headers['Authorization'] = tokenService.getHeader();
return config;
});

authClient.interceptors.response.use(
(response) => {
return response;
},
(response) => response,
async (error) => {
const originalRequest = error.config;
if (error.response.status === 401 && !originalRequest._retry) {
originalRequest._retry = true;
const access_token = await authService.getRefreshToken();
authService.setAuthToken(access_token);
return authClient(originalRequest);
try {
await tokenService.updateAccessToken();
originalRequest.headers['Authorization'] = tokenService.getHeader();
return axios(originalRequest);
} catch (e) {
return Promise.reject(e);
}
}
return Promise.reject(error);
}
Expand Down
11 changes: 5 additions & 6 deletions src/apis/personaAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ export const personaAPI = {
return response.data;
},

// Discover 페르소나 키워드 전체 조회
getDiscoverAllKeyword: async () => {
const response = await authClient.get('/api/personas/discover/all-keywords');
return response.data;
},

// Discover 페르소나 키워드 카테고리별 조회
getDiscoverCategoryKeyword: async (category: string) => {
if (category === 'all') {
const response = await authClient.get('/api/personas/discover/all-keywords');
return response.data;
}

const response = await authClient.get(
`/api/personas/discover/keywords?category=${CATEGORY_TYPE[category].title}`
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { noAuthClient } from '@/apis/client';

export const tokenAPI = {
refresh: async () => {
export const getAccessToken = async () => {
try {
const response = await noAuthClient.get('/api/reissue/access-token');
return response.data;
},
} catch (error) {
console.error('Access Token 갱신 실패:', error);
throw error;
}
};
12 changes: 11 additions & 1 deletion src/apis/userAPI.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authClient, noAuthClient } from '@/apis/client';
import { RegisterRequest } from '@/types/userAPI.type';
import { ReRegisterRequest, RegisterRequest } from '@/types/userAPI.type';

export const userAPI = {
// 신규 유저 등록
Expand All @@ -12,6 +12,16 @@ export const userAPI = {
const response = await noAuthClient.get(`/api/users/check-nickname/${nickname}`);
return response.data;
},
// 유저 정보 조회
getUserInfo: async () => {
const response = await authClient.get('/api/users/infos');
return response.data;
},
// 유저 정보 수정
updateUserInfo: async (userInfo: ReRegisterRequest) => {
const response = await authClient.patch('/api/users/infos', userInfo);
return response.data;
},
// 로그아웃
logout: async () => {
const response = await noAuthClient.post('/api/users/logout');
Expand Down
Binary file removed src/assets/backgrounds/setting.png
Binary file not shown.
Binary file added src/assets/cards/piece/connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/creator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/encourager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/innovator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/insighter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/inventor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/organizer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cards/piece/projector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 0 additions & 25 deletions src/assets/logos/brandLogo.svg

This file was deleted.

21 changes: 12 additions & 9 deletions src/components/DefineResultPage/ResultView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import { DefineResult } from '@/types/test.type';

interface ResultViewProps {
result: DefineResult;
showRetestButton?: boolean;
}

export const ResultView = ({ result }: ResultViewProps) => {
export const ResultView = ({ result, showRetestButton = true }: ResultViewProps) => {
const navigate = useNavigate();

return (
Expand All @@ -26,14 +27,16 @@ export const ResultView = ({ result }: ResultViewProps) => {
<CardSection result={result} />
<DescriptionSection result={result} />
</StyledContent>
<StyledPlainButton
variant="primary2"
onClick={() => {
navigate('/test/define/1');
}}
>
다시 테스트 하기
</StyledPlainButton>
{showRetestButton && (
<StyledPlainButton
variant="primary2"
onClick={() => {
navigate('/test/define/1');
}}
>
다시 테스트 하기
</StyledPlainButton>
)}
</StyledInnerContainer>
);
};
Expand Down
75 changes: 36 additions & 39 deletions src/components/DefineStartPage/DefineDesktopView.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
import { useNavigate } from 'react-router-dom';
import { styled } from 'styled-components';

import backgroundImg from '@/assets/backgrounds/defineBackground.png';
import { PlainButton } from '@/components/common/Button/PlainButton';

export const DefineDesktopView = () => {
const navigate = useNavigate();

const handleClick = () => {
navigate('/test/define/2');
};
export const DefineDesktopView = ({ onNext }: { onNext: () => void }) => {
return (
<div>
<ViewContainer>
<Styled1Container>
<TopContainer>
<TitleTextContainer>
<TitleContainer>
<br />
현재 당신은 어떤 사람인가요?
</TitleContainer>
<SubTitleContainer>
문항은 <span className="highlight">총 3문항</span>으로, 홀랜드 검사 이론을 기반으로
구성되어 있어요.
<br />
정의하기 테스트를 통해 나의 조각 유형을 도출하고,{' '}
<span className="highlight">결과 카드</span>를 받아보세요!
</SubTitleContainer>
</TitleTextContainer>
<PlainButton variant="gray" width="376px" height="48px" onClick={handleClick}>
테스트 시작하기
</PlainButton>
</TopContainer>

<Styled2Container>
<SubTextContainer>
<span className="highlight">홀랜드 검사란,</span>
<ViewContainer>
<Styled1Container>
<TopContainer>
<TitleTextContainer>
<TitleContainer>
<br />
성격 유형과 커리어의 특성을 6개의 유형으로 분류하여 육각형으로 보여주는 검사로,
현재 당신은 어떤 사람인가요?
</TitleContainer>
<SubTitleContainer>
문항은 <span className="highlight">총 3문항</span>으로, 홀랜드 검사 이론을 기반으로
구성되어 있어요.
<br />
셀피스의 정의하기 테스트는 해당 이론에서 착안하여 고안되었습니다.
</SubTextContainer>
</Styled2Container>
</Styled1Container>
</ViewContainer>
</div>
정의하기 테스트를 통해 나의 조각 유형을 도출하고,{' '}
<span className="highlight">결과 카드</span>를 받아보세요!
</SubTitleContainer>
</TitleTextContainer>
<PlainButton variant="gray" width="376px" height="48px" onClick={onNext}>
테스트 시작하기
</PlainButton>
</TopContainer>

<Styled2Container>
<SubTextContainer>
<span className="highlight">홀랜드 검사란,</span>
<br />
성격 유형과 커리어의 특성을 6개의 유형으로 분류하여 육각형으로 보여주는 검사로,
<br />
셀피스의 정의하기 테스트는 해당 이론에서 착안하여 고안되었습니다.
</SubTextContainer>
</Styled2Container>
</Styled1Container>
</ViewContainer>
);
};

Expand Down Expand Up @@ -82,6 +74,9 @@ const TopContainer = styled.div`
align-items: flex-start;
gap: 48px;
display: flex;

transform: scale(0.8);
transform-origin: top left;
`;

const SubTextContainer = styled.div`
Expand Down Expand Up @@ -118,4 +113,6 @@ export const ViewContainer = styled.div`
background-position: right;
display: flex;
overflow-x: auto;

//zoom: 1.25;
`;
66 changes: 30 additions & 36 deletions src/components/DefineStartPage/DefineMobileView.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
import { useNavigate } from 'react-router-dom';
import { styled } from 'styled-components';

import backgroundImg from '@/assets/backgrounds/defineBackground.png';
import { PlainButton } from '@/components/common/Button/PlainButton';

export const DefineMobileView = () => {
const navigate = useNavigate();

const handleClick = () => {
navigate('/test/define/2');
};
export const DefineMobileView = ({ onNext }: { onNext: () => void }) => {
return (
<div>
<ViewContainer>
<StyledContainer>
<TopContainer>
<TitleTextContainer>
<TitleContainer>현재 당신은 어떤 사람인가요?</TitleContainer>
<SubTitleContainer>
문항은 <span className="highlight">총 3문항</span>으로,
<br /> 홀랜드 검사 이론을 기반으로 구성되어 있어요.
<br />
정의하기 테스트를 통해 나의 조각 유형을 도출하고,{' '}
<span className="highlight">결과 카드</span>를 받아보세요!
</SubTitleContainer>
</TitleTextContainer>
<BottomContainer>
<SubTextContainer>
<span className="highlight">홀랜드 검사란,</span>
<br />
성격 유형과 커리어의 특성을 6개의 유형으로 분류하여 육각형으로 보여주는 검사로,
셀피스의 정의하기 테스트는 해당 이론에서 착안하여 고안되었습니다.
</SubTextContainer>
<PlainButton variant="gray" width="100%" height="48px" onClick={handleClick}>
테스트 시작하기
</PlainButton>
</BottomContainer>
</TopContainer>
</StyledContainer>
</ViewContainer>
</div>
<ViewContainer>
<StyledContainer>
<TopContainer>
<TitleTextContainer>
<TitleContainer>현재 당신은 어떤 사람인가요?</TitleContainer>
<SubTitleContainer>
문항은 <span className="highlight">총 3문항</span>으로,
<br /> 홀랜드 검사 이론을 기반으로 구성되어 있어요.
<br />
정의하기 테스트를 통해 나의 조각 유형을 도출하고,{' '}
<span className="highlight">결과 카드</span>를 받아보세요!
</SubTitleContainer>
</TitleTextContainer>
<BottomContainer>
<SubTextContainer>
<span className="highlight">홀랜드 검사란,</span>
<br />
성격 유형과 커리어의 특성을 6개의 유형으로 분류하여 육각형으로 보여주는 검사로,
셀피스의 정의하기 테스트는 해당 이론에서 착안하여 고안되었습니다.
</SubTextContainer>
<PlainButton variant="gray" width="100%" height="48px" onClick={onNext}>
테스트 시작하기
</PlainButton>
</BottomContainer>
</TopContainer>
</StyledContainer>
</ViewContainer>
);
};

Expand Down Expand Up @@ -134,4 +126,6 @@ const ViewContainer = styled.div`
background-image: url(${backgroundImg});
background-size: cover;
background-position: center;

//zoom: 1.25;
`;
Loading