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

[FIX] 채팅 api 에러 수정 1 #96

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 2 additions & 60 deletions src/pages/notice/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,8 @@ import { Link } from 'react-router-dom';

export function Notice() {
return (
<div className='flex flex-col'>
<div className='font-bold'>세상에 이런 폰트가 d나오다니 천재인듯</div>

<div className="font-['100']">Hi this is test For eng.ver </div>

<div className="font-['400']">안녕 서비스임7</div>
<div className="font-['500']">안녕 서비스임7</div>
<div className="font-['600']">안녕 서비스임7</div>
<div className="font-['700']">안녕 서비스임7</div>
<div className="font-['800']">안녕 서비스임7</div>
<div className="font-['900']">안녕 서비스임7</div>

<div className='flex flex-col'>
<Link to='/'>
<div className="font-['100'] ">100-home</div>
</Link>
<Link to='/Login'>
<div className="font-['200'] ">200-login</div>
</Link>
<Link to='/Register'>
<div className="font-['300'] ">300-register</div>
</Link>
<Link to='/TestPage'>
<div className="font-['400']">400-textpage</div>
</Link>
<Link to='/ResultHome'>
<div className="font-['500'] ">500-resulthome</div>
</Link>
<Link to='/TypeResult'>
<div className="font-['500'] ">500-typeresult</div>
</Link>
<Link to='/animaldict'>
<div className="font-['600'] ">600-animaldic</div>
</Link>
<Link to='/verify'>
<div className="font-['700'] ">700-verfiy</div>
</Link>
<Link to='/chat'>
<div className="font-['800'] ">800-chat</div>
</Link>
<Link to='/roommateOption'>
<div className="font-['900'] ">900-roomateOption</div>
</Link>
<Link to='/roommatelist'>
<div className="font-['900'] ">900-roomatelist</div>
</Link>
<Link to='/group'>
<div className="font-['900'] ">900-GroupList</div>
</Link>
<Link to='/notice'>
<div className="font-['900'] ">900-Notice</div>
</Link>
<Link to='/otherpeople'>
<div className="font-['900'] ">900-otherpeople</div>
</Link>
<Link to='/secondexample'>
<div className="font-['900'] ">900-secondexample</div>
</Link>

</div>
<div className="flex flex-col font-['700'] text-2xl">
공지사항
</div>
)
}
2 changes: 1 addition & 1 deletion src/pages/roommatelist/components/CardTotalList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const TypeAtAGlance = ({name}:glance) =>{

</div>
</div>
<Link to={`/chat/${name}`} className="font-['700'] text-xxs ml-2 text-primary-gray flex justify-center mt-[-4px]">
<Link to={`resulthome/${name}`} className="font-['700'] text-xxs ml-2 text-primary-gray flex justify-center mt-[-4px]">
<div onClick={chatClick}> 더 자세히 보기 클릭 →</div>
</Link>
</div>
Expand Down
57 changes: 30 additions & 27 deletions src/pages/roommatelist/components/RoommateCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,34 +486,35 @@ const TypeAtAGlance = ({ nickname, animal,rhythm,smoke,noise, temperature,outgoi
)
}
const CardBack = ({isFrontView,animal,nickname, rhythm,smoke,noise, temperature,outgoing,clean, sleep} : CardBackProps) => {
const [apply_id, setApply_id] = useState('');
const chatClick = async() => {
try {
const response = await fetch(`http://aniroomi-env.eba-rj7upyms.ap-northeast-2.elasticbeanstalk.com/chat/${nickname}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
// const [apply_id, setApply_id] = useState('');
// const chatClick = async() => {
// try {
// const response = await fetch(`http://aniroomi-env.eba-rj7upyms.ap-northeast-2.elasticbeanstalk.com/chat/${nickname}`, {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },

credentials: 'include',
});
// credentials: 'include',
// });

// Handle the response as needed
console.log(response);
// // Handle the response as needed
// console.log(response);

// Check if login is successful, then redirect to StarPage
if (response.ok) {
const data = await response.json();
console.log(`data : ${data}`);
// // Check if login is successful, then redirect to StarPage
// if (response.ok) {
// const data = await response.json();
// console.log(`data : ${data.substring(1)}`);


setApply_id(data.apply_id)
console.log(`${apply_id}채팅으로 넘어갑니다.`);
}
} catch (error) {
console.error('Error during login:', error);
}
}
// setApply_id(data.substring(1))
// console.log(`${data.substring(1)}채팅으로 넘어갑니다.`);
// }
// } catch (error) {
// console.error('Error during login:', error);
// }
// }
const apply_id = nickname;
return (
<section
className={`group absolute inset-0 z-0 flex h-full w-full flex-col items-start justify-between rounded-xl bg-[#F7F8FB] px-2 py-1.5 transition duration-300 ease-in-out ${
Expand All @@ -522,11 +523,13 @@ const CardBack = ({isFrontView,animal,nickname, rhythm,smoke,noise, temperature,
>
<div className="flex flex-col p-2 ml-2 mr-2">
<Link to={`/chat/${apply_id}`} className="mb-1 flex flex-row gap-4 justify-center ">
<div onClick={chatClick}>
<div className="font-['900'] text-bold text-3xl text-primary-logo ">채팅하기</div>

{/* <div className="font-['900'] text-bold text-3xl text-primary-logo" onClick={chatClick}>채팅하기</div>
<img src={process.env.PUBLIC_URL + '/message.png'} alt="logo" style={{width : '45px'}} onClick={chatClick}/>
*/}
<div className="font-['900'] text-bold text-3xl text-primary-logo" >채팅하기</div>
<img src={process.env.PUBLIC_URL + '/message.png'} alt="logo" style={{width : '45px'}}/>

</div>

</Link>

<Divider />
Expand Down