Skip to content
Snippets Groups Projects
Commit 4847d788 authored by Gaeon Kim's avatar Gaeon Kim
Browse files
parents 3730c659 f6f8fac1
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,9 @@ function InfiniteScroll(props){
const response = await fetch(`/api/${page}${queryString1}`);
const jsonData = await response.json();
const newData = jsonData[page];
setMinId(jsonData['minId']);
setMinDate(jsonData['minDate']);
if(page==='channels'){
setMinDate(jsonData['minDate']);
const newData = jsonData[page];
......@@ -77,6 +80,12 @@ function InfiniteScroll(props){
setIsLoading(true);
try{
const response = await fetch(`/api/${page}?minId=${minId}${queryString2}`);
console.log(`/api/${page}?minId=${minId}${queryString2}`);
const jsonData = await response.json();
const newData = jsonData[page];
setMinId(jsonData['minId']);
if(page==='channels'){
const response = await fetch(`/api/${page}?${min}=${minDate}${queryString2}`);
......@@ -100,11 +109,8 @@ function InfiniteScroll(props){
}
setItems((prevItem) => [...prevItem, ...components]);
}
}else if(page==='recruits'){
const response = await fetch(`/api/${page}?${min}=${minId}${queryString2}`);
const jsonData = await response.json();
setMinId(jsonData['minId']);
const newData = jsonData[page];
}else {
if(newData.length > 0) {
const components = newData.map((item) => (
<PageItem data={item}/>
......
......@@ -36,9 +36,9 @@ function Notice(props){
const sortedNotice = subscribeNotices.sort((a, b) => a.date - b.date);
const noticeComponents = sortedNotice.map((notice) => (
<p className={styles.noticeContent}>
<span className={styles.channel}>{notice.channel}</span>
<span className={styles.date}>{notice.date}</span>
<span className={styles.content}>{notice.title}</span>
<span className={styles.channel}>{notice.channelNickname}</span>
<span className={styles.noticeTitle}>{notice.title}</span>
<span className={styles.content}>{notice.content}</span>
</p>
));
......
......@@ -65,15 +65,11 @@
float: left;
}
.time{
}
.channel{
}
.date{
.noticeTitle{
}
......
import React from 'react';
import createVoteStyles from './createVote.module.css';
function CreateVote({ id, data }){
function CreateVote({ data, time }){
const createVote = async ()=>{
try{
const response = await fetch(`/api/recruits/${id}/times/save`,{
const response = await fetch(`/api/recruits/${data.id}/times/save`,{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
body: JSON.stringify(time),
});
if (response.ok){
......@@ -26,7 +26,11 @@ function CreateVote({ id, data }){
return (
<div>
<div>
{data.vote === 'Before' ?(
<button type='button' className={createVoteStyles.createVote} onClick={createVote}>투표 생성</button>
):(
<button type='button' className={createVoteStyles.endCreateVote} onClick={createVote} disabled>투표 생성</button>
)}
</div>
</div>
......
......@@ -10,3 +10,16 @@
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* 그림자 추가 */
transition: background-color 0.3s, color 0.3s, transform 0.3s;
}
.endCreateVote{
width: 90px;
height:35px;
border:none;
border-radius: 5px;
cursor: pointer;
color: white;
background-color:#b5b9c5;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* 그림자 추가 */
transition: background-color 0.3s, color 0.3s, transform 0.3s;
}
\ No newline at end of file
......@@ -53,6 +53,7 @@ const ModifyRecruit=({isOpen, onClose, data})=>{
const handleSave = (e) => {
e.preventDefault()
if(formData.info.timeCategory === "D"){
modifyInfo({
...formData,
......
......@@ -146,7 +146,6 @@ function RecruitList(){
const [generatedUrl, setGeneratedUrl] = useState('recruits');
const [firstQueryString, setFirstQueryString] = useState('');
const [secondQueryString, setSecondQueryString] = useState('');
const [forceRender, setForceRender] = useState(false);
const handleUrlGeneration = (url) => {
setGeneratedUrl(url);
......@@ -160,11 +159,6 @@ function RecruitList(){
setSecondQueryString(url);
};
useEffect(() => {
setForceRender((prev) => !prev);
console.log('Component has been re-rendered');
}, [generatedUrl, firstQueryString, secondQueryString])
return(
<div className={recruitListStyles.RecruitList}>
<Search
......@@ -177,6 +171,7 @@ function RecruitList(){
pagename={generatedUrl}
queryString1={firstQueryString}
queryString2={secondQueryString}
min='minId'
/>
</div>
)
......
......@@ -231,7 +231,7 @@ function TimeInquiry({ isOpen, onClose, data }){
<div className={timeInquiryStyles.voteButton}>
<div className={timeInquiryStyles.createVote}>
<CreateVote id={data.id} data={selectedTimes}/>
<CreateVote data={data} time={selectedTimes}/>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment