-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/#170
- Loading branch information
Showing
24 changed files
with
769 additions
and
772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// post | ||
export interface PostSurveyRequest { | ||
age: number; | ||
gender: string; | ||
occupation: string; | ||
region: string; | ||
source: string; | ||
purpose: string; | ||
} | ||
|
||
export interface PostSurveyResponse { | ||
code: number; | ||
message: string; | ||
data: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// import { PostInviteTeamRequest } from '../@types/InviteTeam'; | ||
import axiosInstance from '../axiosConfig'; | ||
|
||
const postInviteTeam = async (invitationId: string) => { | ||
try { | ||
const response = await axiosInstance.post('/team/accept-invitation', { | ||
invitationCode: invitationId, | ||
}); | ||
console.log('팀원 초대 성공', response.data); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error('팀원 초대 실패'); | ||
} | ||
}; | ||
|
||
export default postInviteTeam; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PostSurveyRequest, PostSurveyResponse } from '../@types/Survey'; | ||
import axiosInstance from '../axiosConfig'; | ||
|
||
// post 요청 | ||
export const PostSurvey = async (requestData: PostSurveyRequest): Promise<PostSurveyResponse> => { | ||
try { | ||
const response = await axiosInstance.post<PostSurveyResponse>('/surveys/response', requestData); | ||
console.log('설문조사 전송 성공', response.data); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error('실패'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
import React, { useState } from 'react'; | ||
import { ko } from 'date-fns/locale/ko'; | ||
import React from 'react'; | ||
import { Input } from '@chakra-ui/react'; | ||
import 'react-datepicker/dist/react-datepicker.css'; | ||
import * as S from '@/styles/createRetro/modal/StartDateCalendar.style'; | ||
import '@/styles/createRetro/modal/Calendar.css'; | ||
|
||
interface StartDateCalendarProps { | ||
onDateChange: (dateString: string) => void; | ||
onDateChange: (date: Date) => void; | ||
} | ||
|
||
const StartDateCalendar: React.FC<StartDateCalendarProps> = ({ onDateChange }) => { | ||
const [selectedDate, setSelectedDate] = useState(new Date()); | ||
|
||
const handleDateChange = (date: Date) => { | ||
setSelectedDate(date); | ||
const isoDateString = date.toISOString(); // 백엔드 request body에 보낼 날짜 타입 | ||
onDateChange(isoDateString); | ||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const dateString = event.target.value; // 사용자가 입력한 날짜 문자열 | ||
const selectedDate = new Date(dateString); // 문자열을 Date 객체로 변환 | ||
onDateChange(selectedDate); // 부모 컴포넌트로 전달 | ||
}; | ||
|
||
return ( | ||
<S.DateInput | ||
selected={selectedDate} | ||
onChange={handleDateChange} | ||
locale={ko} | ||
dateFormat="yyyy-MM-dd" | ||
showPopperArrow={false} | ||
/> | ||
); | ||
return <Input placeholder="회고 시작일 선택" size="md" type="date" onChange={handleChange} />; | ||
}; | ||
|
||
export default StartDateCalendar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useParams, useNavigate } from 'react-router-dom'; | ||
import postInviteTeam from '@/api/inviteTeamApi/postInviteTeam'; | ||
|
||
const AcceptInvite: React.FC = () => { | ||
const { invitationId } = useParams<{ invitationId?: string }>(); | ||
const navigate = useNavigate(); | ||
const [inviteSuccess, setInviteSuccess] = useState(false); | ||
|
||
useEffect(() => { | ||
const acceptInvitation = async () => { | ||
try { | ||
if (invitationId) { | ||
await postInviteTeam(invitationId); | ||
setInviteSuccess(true); // 초대 요청이 성공했을 때 상태를 true로 변경 | ||
} else { | ||
console.error('InvitationId 추출 실패'); | ||
} | ||
} catch (error) { | ||
console.error('에러', error); | ||
} | ||
}; | ||
|
||
acceptInvitation(); | ||
}, [invitationId]); | ||
|
||
useEffect(() => { | ||
if (inviteSuccess) { | ||
// 초대 성공 시 알림을 띄우고 retrolist 페이지로 navigate | ||
alert('초대 성공했습니다!'); | ||
navigate('/retrolist'); | ||
} | ||
}, [inviteSuccess, navigate]); | ||
|
||
return <div>초대를 수락하는 중...</div>; | ||
}; | ||
|
||
export default AcceptInvite; |
Oops, something went wrong.