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

[#129] 공지사항, 펀시스템 상세정보 및 댓글 API 연결 #155

Merged
merged 26 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7553b4f
feat: 공지사항 API 연결
SujinKim1127 Nov 21, 2023
2c6de49
fix: utility Header 로 변경
SujinKim1127 Nov 21, 2023
c315916
feat: /notice/info/{id} 로 변경
SujinKim1127 Nov 21, 2023
fd16011
style: 디자인 수정
SujinKim1127 Nov 21, 2023
7d131bf
feat: 펀시스템 API 연결
SujinKim1127 Nov 21, 2023
0129b03
feat: 공지사항 API 연결
SujinKim1127 Nov 21, 2023
3cbad4b
fix: rebase 수정
SujinKim1127 Nov 27, 2023
449dced
refact: 파일 위치 수정
SujinKim1127 Nov 28, 2023
2a48f4d
feat: 공지사항 API 연결
SujinKim1127 Nov 28, 2023
3a801c0
feat: comment API 연결
SujinKim1127 Dec 2, 2023
8551deb
refactor: eslint 정렬 수정
SujinKim1127 Dec 4, 2023
806d018
feat: 라우터 설정
SujinKim1127 Dec 4, 2023
adbdf53
feat: 댓글 api 연결
SujinKim1127 Dec 5, 2023
b74bd22
feat: community API 연결
SujinKim1127 Dec 5, 2023
9f930a8
feat: 조건문으로 api 연결
SujinKim1127 Dec 5, 2023
79cb05e
refactor: 변수명 공통으로 변경
SujinKim1127 Dec 5, 2023
fc1aee4
fix: undefined error 수정
SujinKim1127 Dec 5, 2023
81c8208
fix: 첨부파일 조건 수정
SujinKim1127 Dec 5, 2023
9566003
fix: rebase api 오류 수정
SujinKim1127 Dec 18, 2023
2463663
style: 배경 흰색으로 적용
SujinKim1127 Dec 18, 2023
4256a78
feat: url 클립보드 복사
SujinKim1127 Dec 20, 2023
7cdb10b
fix: build 오류 수정
SujinKim1127 Dec 20, 2023
344eb0d
fix: build 오류 해결
SujinKim1127 Dec 20, 2023
e1513b2
feat: 필요한 import
SujinKim1127 Dec 20, 2023
3e45f15
feat: 업데이트
halfmoon-mind Dec 20, 2023
1077e7a
Merge branch 'feat/#129_' of https://github.com/DaITssu/daitssu-clien…
halfmoon-mind Dec 20, 2023
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
59 changes: 46 additions & 13 deletions src/apis/communityAPIS.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import { axiosInstance } from '@/apis/axiosInstance';
import axios from 'axios';

export const getCommunityItemAPI = async (inquiry :String = "", category : String, page:number=0) => {
export const getCommunityItemAPI = async (
inquiry: String = '',
category: String,
page: number = 0,
) => {
try {
if(category === "ALL"){
if (category === 'ALL') {
const response = await axiosInstance.get(`/community/article`, {
params :{
inquiry : String(inquiry),
page : page,
}
params: {
inquiry: String(inquiry),
page: page,
},
});
return response.data;
}else{
const response = await axiosInstance.get(`/community/article/topic/${category}`, {
params :{
inquiry : String(inquiry),
page : page,
}
});
} else {
const response = await axiosInstance.get(
`/community/article/topic/${category}`,
{
params: {
inquiry: String(inquiry),
page: page,
},
},
);
return response.data;
}
} catch (error) {
Expand All @@ -27,3 +34,29 @@ export const getCommunityItemAPI = async (inquiry :String = "", category : Strin
return null;
}
};

export const getCommunityInfoAPI = async (articleID: number) => {
try {
const response = await axiosInstance.get(`/community/article/${articleID}`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getCommunityInfoCommentAPI = async (articleID: number) => {
try {
const response = await axiosInstance.get(
`/community/article/${articleID}/comments`,
);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};
26 changes: 26 additions & 0 deletions src/apis/funsystemAPIs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { axiosInstance } from '@/apis/axiosInstance';
import axios from 'axios';

export const getFunsystemInfoAPI = async (funId: number) => {
try {
const response = await axiosInstance.get(`/funsystem/page/${funId}`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getFunsystemInfoCommentAPI = async (funId: number) => {
try {
const response = await axiosInstance.get(`/funsystem/${funId}/comments`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};
107 changes: 67 additions & 40 deletions src/apis/noticeAPIS.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { axiosInstance } from "@/apis/axiosInstance";
import axios from "axios";
import { axiosInstance } from '@/apis/axiosInstance';
import axios from 'axios';

//Todo : 페이지네이션
export const getNoticeAPI = async (searchKeyword:String="") => {
//Todo : 페이지네이션
export const getNoticeAPI = async (searchKeyword: String = '') => {
try {
const response = await axiosInstance.get(`/notice`,{
params : {
searchKeyword : String(searchKeyword),
}
const response = await axiosInstance.get(`/notice`, {
params: {
searchKeyword: String(searchKeyword),
},
});
return response.data;
} catch (error) {
Expand All @@ -18,28 +18,29 @@ export const getNoticeAPI = async (searchKeyword:String="") => {
}
};


export const getNoticeAPIwithCategory = async (searchKeyword:String ="",category :String, page:number =0) => {
export const getNoticeAPIwithCategory = async (
searchKeyword: String = '',
category: String,
page: number = 0,
) => {
try {
if(category === "ALL"){
const response = await axiosInstance.get(`/notice`,{
params : {
searchKeyword : String(searchKeyword),
page : page,
}
if (category === 'ALL') {
const response = await axiosInstance.get(`/notice`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}else{
const response = await axiosInstance.get(`/notice/${category}`,{
params : {
searchKeyword : String(searchKeyword),
page : page,
}
} else {
const response = await axiosInstance.get(`/notice/${category}`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}


} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
Expand All @@ -48,31 +49,57 @@ export const getNoticeAPIwithCategory = async (searchKeyword:String ="",category
}
};

export const getFunSystemAPIwithCategory = async (searchKeyword:String ="",category :String, page:number =0) => {
export const getFunSystemAPIwithCategory = async (
searchKeyword: String = '',
category: String,
page: number = 0,
) => {
try {
if(category === "ALL"){
const response = await axiosInstance.get(`/funsystem`,{
params : {
searchKeyword : String(searchKeyword),
page : page,
}
if (category === 'ALL') {
const response = await axiosInstance.get(`/funsystem`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}else{
const response = await axiosInstance.get(`/funsystem/${category}`,{
params : {
searchKeyword : String(searchKeyword),
page : page,
}
} else {
const response = await axiosInstance.get(`/funsystem/${category}`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}


} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};
};

export const getNoticeInfoAPI = async (noticeId: number) => {
try {
const response = await axiosInstance.get(`/notice/page/${noticeId}`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getNoticeInfoCommentAPI = async (noticeId: number) => {
try {
const response = await axiosInstance.get(`/notice/${noticeId}/comments`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};
105 changes: 105 additions & 0 deletions src/apis/noticeAPIs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { axiosInstance } from '@/apis/axiosInstance';
import axios from 'axios';

//Todo : 페이지네이션
export const getNoticeAPI = async (searchKeyword: String = '') => {
try {
const response = await axiosInstance.get(`/notice`, {
params: {
searchKeyword: String(searchKeyword),
},
});
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getNoticeAPIwithCategory = async (
searchKeyword: String = '',
category: String,
page: number = 0,
) => {
try {
if (category === 'ALL') {
const response = await axiosInstance.get(`/notice`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
} else {
const response = await axiosInstance.get(`/notice/${category}`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getFunSystemAPIwithCategory = async (
searchKeyword: String = '',
category: String,
page: number = 0,
) => {
try {
if (category === 'ALL') {
const response = await axiosInstance.get(`/funsystem`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
} else {
const response = await axiosInstance.get(`/funsystem/${category}`, {
params: {
searchKeyword: String(searchKeyword),
page: page,
},
});
return response.data;
}
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getNoticeInfoAPI = async (noticeId: number) => {
try {
const response = await axiosInstance.get(`/notice/page/${noticeId}`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};

export const getNoticeInfoCommentAPI = async (noticeId: number) => {
try {
const response = await axiosInstance.get(`/notice/${noticeId}/comments`);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error.response?.data);
}
return null;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as styles from '../../notice/NoticeList.styles';
import NoticeItem, { NoticeItemProps } from '../../notice/NoticeItem';
import React, { FC, ChangeEvent, useState, useEffect } from 'react';


const NoticeList: FC<{ items: NoticeItemProps[] }> = ({ items }) => {
const [mounted, setMounted] = useState<boolean>(false); //기본 브라우저의 클라이언트 사이드 렌더링 제거

Expand All @@ -14,12 +13,12 @@ const NoticeList: FC<{ items: NoticeItemProps[] }> = ({ items }) => {
mounted && (
<styles.NoticeListBoxShort>
{items.map((item: NoticeItemProps, key: number) => {
return <NoticeItem key={key} item={item} />;
return <NoticeItem type="notice" key={key} item={item} />;
})}
</styles.NoticeListBoxShort>
)
);
};

export default NoticeList;
3
3;
4 changes: 2 additions & 2 deletions src/components/common/Comment/Comment.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { COLORS } from '@/styles/constants/colors';
import { TEXT_STYLES } from '@/styles/constants/textStyles';
import styled from '@emotion/styled';

export const CommentWhiteBox = styled.div`
padding: 15px 10px;
export const CommentWhiteBox = styled.div<{ padding: boolean }>`
padding: 15px 10px 15px ${(props) => (props.padding ? '10px' : '60px')};
display: flex;
`;

Expand Down
Loading
Loading