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

feat: GNB5 api 연결 / GNB4 디자인 완성 / #72

Merged
merged 23 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
248e58b
feat: GNB5 학교인증 input 레이블 추가
crolvlee Aug 15, 2024
25453be
fix: GNB3 회비 등록 input 레이블 수정 (리액트캘린더 문제는 아직 해결 필요)
crolvlee Aug 15, 2024
d19b6d6
fix: GNB3 회비 사용내역 추가 input 레이블 수정 (리액트캘린더 문제 아직 해결 필요)
crolvlee Aug 15, 2024
fc67f64
refactor: GNB4 Match 폴더구조 정리
crolvlee Aug 16, 2024
ca6d022
feat: GNB4 신청내역 헤더 디자인 변경사항 반영
crolvlee Aug 16, 2024
7a9c304
feat: 매치, 용병 글 작성 인원 선택 필드 추가
crolvlee Aug 16, 2024
ca877ed
fix: 일부 모달 스크롤 문제 해결
crolvlee Aug 16, 2024
2b67d8e
feat: GNB5 프로필 이미지, 이름 API 연결, zustand로 유저 정보 전역 상태 관리
crolvlee Aug 16, 2024
b90997a
feat: 프로필 변경 api 연결 / useAuthStore 수정
crolvlee Aug 16, 2024
992073e
feat: 학교 인증 api 연결
crolvlee Aug 17, 2024
17a1263
feat: 학교 인증 후 처리
crolvlee Aug 17, 2024
2a67df9
feat: 매치글 컴포넌트 바 디자인 삭제 및 변경사항 반영
crolvlee Aug 17, 2024
ff02ecd
feat: 구인글 컴포넌트 디자인 변경사항 반영
crolvlee Aug 17, 2024
3594c5f
feat: 더보기 버튼 추가
crolvlee Aug 17, 2024
d9cb171
feat: 매치요청 모달 UI구현
crolvlee Aug 17, 2024
7c64193
feat: 매치 상세보기 UI 구현
crolvlee Aug 18, 2024
5e6e8b0
feat: 매치 컴포넌트 디자인 수정사항 반영
crolvlee Aug 19, 2024
4837cc0
feat: 매치, 용병 카드 디자인 수정사항 반영
crolvlee Aug 19, 2024
36be66b
feat: GNB3헤더 수정 및 속한 동아리 불러오는 api 연결
crolvlee Aug 19, 2024
be3d677
fix: 액세스토큰 로컬스토리지 저장에 따른 위치 수정
crolvlee Aug 19, 2024
e168886
feat: 유저 정보 전역에 저장하는 내용 수정 / GNB5에서 유저 정보 불러오는 내용 수정
crolvlee Aug 19, 2024
e3f74d2
feat: 매치 생성 api 연결 (미완성)
crolvlee Aug 19, 2024
61c9ac7
merge: Merge remote-tracking branch 'upstream/develop' into web_develop
crolvlee Aug 19, 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
10 changes: 0 additions & 10 deletions src/api/api.jsx

This file was deleted.

18 changes: 18 additions & 0 deletions src/apis/api/match.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import api from "../utils/api";

// 매치 생성 API 호출 함수
export const createMatch = (accessToken, matchData) => {
return api.post('/v1/api/matches', matchData, {
headers: {
'Content-Type': 'application/json',
access: `${accessToken}`,
}
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error('매치 생성 중 오류가 발생했습니다:', error);
throw error;
});
};
48 changes: 48 additions & 0 deletions src/apis/api/user.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import api from "../utils/api";

// 사용자 데이터를 가져오는 API 호출 함수
export const getUserInfo = (accessToken) => {
return api.get('/v1/api/members/info', {
headers: {
'Content-Type': 'application/json',
access: `${accessToken}`,
},
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error('getUserInfo 실패:', error);
throw error;
});
};

// 사용자가 속한 동아리 정보를 가져오는 API 호출 함수
export const getUserClubs = (accessToken) => {
return api.get('/v1/api/members/clubs', {
headers: {
'Content-Type': 'application/json',
access: `${accessToken}`,
},
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error('getUserClubs 실패:', error);
throw error;
});
};

// 사용자가 관리자로 속한 동아리 정보를 필터링하는 함수
export const getAdminClubs = async (accessToken) => {
try {
const clubs = await getUserClubs(accessToken);
const adminClubs = clubs.memberClubResponseList.filter(club => club.isAdmin);
return adminClubs;
} catch (error) {
console.error('getAdminClubs 실패:', error);
throw error;
}
};

50 changes: 50 additions & 0 deletions src/apis/utils/api.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import axios from 'axios';
import useAuthStore from '../../stores/useAuthStore';

const api = axios.create({
baseURL: process.env.REACT_APP_SERVER_URL,
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
});

let isTokenRefreshing = false; // 토큰 재발급 중 여부를 체크하기 위한 플래그

// Axios 인터셉터로 401 에러 발생 시 재발급 로직 추가
api.interceptors.response.use(
response => response,
async (error) => {
const originalRequest = error.config;

if (error.response.status === 401 && !originalRequest._retry) {
if (isTokenRefreshing) return Promise.reject(error); // 이미 재발급 중이면 추가 재발급 방지
console.log("이미 발급 중인지 여부: ", isTokenRefreshing);
originalRequest._retry = true;
isTokenRefreshing = true;

try {
// 토큰 재발급 시도
await useAuthStore.getState().reissueTokens();

// 로컬 스토리지에서 갱신된 액세스 토큰 가져오기
const accessToken = localStorage.getItem('accessToken');

// 새로운 액세스 토큰으로 헤더 업데이트
originalRequest.headers['access'] = accessToken;

isTokenRefreshing = false;

// 재발급 후 원래 요청 재시도
return api(originalRequest);
} catch (err) {
isTokenRefreshing = false;
return Promise.reject(err); // 재발급 실패 시 에러 반환
}
}

return Promise.reject(error);
}
);

export default api;
3 changes: 3 additions & 0 deletions src/assets/icons/arrow-down-grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/arrow-right-grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/close-white.svg
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/match/club-grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/match/people-grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions src/assets/match/background_decoration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 13 additions & 10 deletions src/pages/group/fee/ExpenseCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const Container = styled.div`
max-width: 649px;
justify-content: center;
background-color: white;
display: flex;
flex-direction: column;
`;

const HeaderContainer = styled.div`
Expand Down Expand Up @@ -66,28 +68,30 @@ const ContentContainer = styled.div`
display: flex;
flex-direction: column;
padding: 20px;
gap: 16px;
`;

const FieldContainer = styled.div`
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 10px;
width: 100%;
position: relative;
gap: 8px;
`;

const Label = styled.div`
font-size: 18px;
color: ${({ theme }) => theme.colors.neutral[400]};
width: 40%;
width: 100%;
font-size: 16px;
font-weight: 500;
color: ${({ theme }) => theme.colors.neutral[500]};
`;

const Input = styled.input`
width: 60%;
width: 100%;
padding: 10px;
border: none;
border-radius: 8px;
background-color: ${({ theme }) => theme.colors.neutral[100]};
background-color: ${({ theme }) => theme.colors.neutral[50]};
color: ${({ theme }) => theme.colors.neutral[700]};
font-size: 16px;
/* input 타입이 number일 때 스타일 */
Expand All @@ -104,7 +108,6 @@ const Input = styled.input`
`;



const ExpenseCreate = ({ closeExpenseCreate }) => {
const [expenseDate, setExpenseDate] = useState(new Date());
const [showCalendar, setShowCalendar] = useState(false);
Expand Down Expand Up @@ -147,7 +150,7 @@ const ExpenseCreate = ({ closeExpenseCreate }) => {
)}
</FieldContainer>
<FieldContainer>
<Label>금액 (원)</Label>
<Label>사용 금액 (원)</Label>
<Input
type="number"
min="0" // 최소값을 0으로 설정
Expand Down
Loading