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: 홈화면 1차 개발 #17 #27

Merged
merged 1 commit into from
Jul 28, 2024
Merged
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
18 changes: 7 additions & 11 deletions src/components/PlaceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,17 @@ export default function PlaceModal({ isOpen, onClose }: ModalProps) {
if (selectedOption === 'friend') {
setCurrentView('shareLink');
const { data } = await axios.post(BACKEND_URL + '/api/rooms');
setRoomId(data.data.id);
await setRoomId(data.data.id);
} else {
const { data } = await axios.post(BACKEND_URL + '/api/rooms');
setRoomId(data.data.id);
try {
const { data, status } = await axios.get(BACKEND_URL + '/api/midpoints');

console.log('백에서 준 data', data);
console.log('백에서준 상태', status);
// 선택한 것에 따라 결과화면으로 이동되도록 요청하는 url필요
const { data } = await axios.post(BACKEND_URL + '/api/rooms');
const newRoomId = data.data.id;
navigate(`/page/alone/${newRoomId}`);
} catch (error: any) {
if (error.response && error.response.status === 401) {
// 내가 개인 또는 개개인을 선택했는지에 따라 다른 url로 요청한다.
if (selectedOption === 'alone') {
navigate('/page/alone/123'); // 위에서 방을 생성하고 얻은 방 id값을 넣는다. (이거 로그인 url을 따로 만들어서 로그인 페이지로 가도록 수정 필요/page/login)
if (roomId) {
console.log('here!');
navigate(`/page/alone/${roomId}`);
}
} else if (error.response && error.response.status === 403) {
} else {
Expand Down
Loading