Skip to content

Commit

Permalink
Merge pull request #214 from 42-world/hotfix
Browse files Browse the repository at this point in the history
Hotfix : 배포 전 발견한 에러 수정. 익명 게시판 주석 처리.
  • Loading branch information
Skyrich2000 authored Mar 12, 2022
2 parents 8850ed3 + fe5ff63 commit c40fddc
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/Network/APIType.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import axios from 'axios';
export function url(path) {
// const version = 'v1'; // process.env.REACT_APP_API_VERSION

// return `https://api.42world.kr${path}`; // 실제 배포 API 서버
return `http://api-alpha.42world.kr:8888${path}`; // 개발용 서버, 토큰 하드코딩으로 들어있어야 함.
return `https://api.42world.kr${path}`; // 실제 배포 API 서버
// return `http://api-alpha.42world.kr:8888${path}`; // 개발용 서버, 토큰 하드코딩으로 들어있어야 함.
// return `http://localhost:8888${path}`; // Live share 할 때 서버
}

export function AXIOS(option) {
return axios({
...option,
withCredentials: true,
headers: {
// https://api-alpha.42world.kr 로 요청 시 필요. 배포 시에는 주석화
Authorization: process.env.REACT_APP_MASTER_ACCESS_TOKEN, // 루트에 .env 파일 만든 후 REACT_APP_MASTER_ACCESS_TOKEN을 가져옴.
},
// headers: {
// // https://api-alpha.42world.kr 로 요청 시 필요. 배포 시에는 주석화
// Authorization: process.env.REACT_APP_MASTER_ACCESS_TOKEN, // 루트에 .env 파일 만든 후 REACT_APP_MASTER_ACCESS_TOKEN을 가져옴.
// },
});
}
19 changes: 19 additions & 0 deletions src/Network/ArticleService.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@ const ArticleService = {
* `200` : success \
* `401` : fail
*/
getAllArticles: async (categoryId, page) => {
const method = 'GET';
const url = articleUrl('');
const take = 1000;
// const take = 3;
const params = { categoryId, page, take };

let response;
try {
response = await API.AXIOS({
params,
method,
url,
});
} catch (error) {
alert(error);
}
return response.data;
},
getArticles: async (categoryId, page) => {
const method = 'GET';
const url = articleUrl('');
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/CategoryPage/Components/CategoryBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const CategoryBody = () => {

// 존재하지 않는 categortId 일 경우의 예외 처리, 하드 코딩.
useEffect(() => {
if (categoryId > 3) {
if (categoryId > 3 || categoryId == 2) {
navi('/error');
}
setArticles([]);
Expand Down Expand Up @@ -98,6 +98,7 @@ const CategoryBody = () => {
}}
>
{cateList.map((cate, idx) => {
if (idx === 1) return;
return <option value={idx}>{cate}</option>;
})}
</NativeSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const CreateArticleBody = () => {
const [title, setTitle] = useState('');
const [content, setContent] = useState('');
const [curCate, setCurCate] = useState(0);
const cateList = ['자유 게시판', '익명 게시판'];
const cateList = ['자유 게시판'];
const [isSending, setIsSending] = useState(false);
const [anchorEl, setAnchorEl] = useState(null);

Expand Down
12 changes: 4 additions & 8 deletions src/Pages/MainPage/Components/Community.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ const Community = ({
}) => {
return (
<>
<List
disablePadding={true}
component="nav"
aria-label="mailbox folders"
>
<List disablePadding={true} component="nav" aria-label="mailbox folders">
{bestArticles &&
bestArticles.map(article => {
return (
Expand Down Expand Up @@ -61,8 +57,8 @@ const Community = ({
);
})}
</Styled.StyledList>
<Styled.ListDivider /> {/* margin="0.4rem" */}
<Styled.StyledList
<Styled.ListDivider />
{/* <Styled.StyledList
disablePadding={true}
component="nav"
aria-label="mailbox folders"
Expand All @@ -86,7 +82,7 @@ const Community = ({
/>
);
})}
</Styled.StyledList>
</Styled.StyledList> */}
</>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/Pages/MainPage/Components/MainBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ const MainBody = () => {

useEffect(() => {
const getFreeArticles = async () => {
const response = await ArticleService.getArticles(1);
const response = await ArticleService.getAllArticles(1);
setFreeArticles(response.data);
};

const getAnonyArticles = async () => {
const response = await ArticleService.getArticles(2);
const response = await ArticleService.getAllArticles(2);
setAnonyArticles(response.data);
};

const getNotiArticles = async () => {
const response = await ArticleService.getArticles(3);
const response = await ArticleService.getAllArticles(3);
setNotiArticles(response.data);
};

Expand All @@ -61,7 +61,7 @@ const MainBody = () => {
};
getBestArticles();
getFreeArticles();
getAnonyArticles();
// getAnonyArticles();
getNotiArticles();
}, []);

Expand Down

0 comments on commit c40fddc

Please sign in to comment.