-
Notifications
You must be signed in to change notification settings - Fork 2
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: 트랙 추가하기 기능 구현 #419
feat: 트랙 추가하기 기능 구현 #419
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다ㅎㅎ 제안드린것일 뿐이고 빨리 마무리하는게 우선이니깐 대략적으로만 봐주시고 머지하셔도 될 것 같아요ㅎㅎ
import { API } from "./axios"; | ||
|
||
// 트랙 생성 | ||
export const addTrack = async (projectId: string, params: {}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params에 빈 객체로 타입을 설정하면 addTrack 호출부에서 params에 key 넣을 때 타입에러가 뜨진 않나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormData 타입이 빈 객체로 정의되어 있어서 에러가 발생하지는 않는 것으로 보여요. 이전 프로젝트 생성할 때 작성했던 코드를 재사용하다가 parameter 타입을 놓쳤네요.. 여기선 FormData
타입을 사용하는게 더 정확할 것 같아요!
} = useTrackSetting(); | ||
function TrackSetting({ projectTitle, bpmState, trackTags, tracks, onTrackCreate }: ProjectInfoType) { | ||
const { title, inputDeviceId, inputTextDevice, trackTag, handleTitleInput, handleTrackTagSelect, handleDeviceClick } = | ||
useTrackSetting(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier가 이렇게 포맷팅 시켜주나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네! printWidth를 120으로 설정해둬서 그런가봐요..😂
if (!title || !trackTag || !recordedAudio) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제목, 태그, 녹음에 대한 사용자 액션을 유도하는 얼럿을 추가해주는 것은 어떨까요??
if (!title || !trackTag || !recordedAudio) { | |
return; | |
} | |
const requiredProperties = [title, trackTag, recordedAudio]; | |
const errorPropertyIdx = requiredProperties.fineIndex((item) => !item); | |
if (errorPropertyIdx > -1) { | |
alert(`${requiredProperties[errorPropertyIdx]}을 채워주세요.`); | |
return; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오.. 이렇게 required 요소를 체크하는 방법 좋은 것 같아요! 👍🏻
const recordedBlob = await getAudioBlob(audio); | ||
|
||
const formData = new FormData(); | ||
formData.append("trackName", title); | ||
formData.append("trackTag", trackTag); | ||
formData.append("audioFile", recordedBlob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인스턴스 생성 구끼리 인접하게 두는게 더 깔끔해보일 것 같아요ㅎㅎ
const recordedBlob = await getAudioBlob(audio); | |
const formData = new FormData(); | |
formData.append("trackName", title); | |
formData.append("trackTag", trackTag); | |
formData.append("audioFile", recordedBlob); | |
const recordedBlob = await getAudioBlob(audio); | |
const formData = new FormData(); | |
formData.append("trackName", title); | |
formData.append("trackTag", trackTag); | |
formData.append("audioFile", recordedBlob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 코드를 읽을 때 formData를 생성하는 부분이 한 블록으로 읽히면 좋을 것 같아서 묶어뒀어요. 저도 변수 선언부가 인접해있으면 깔끔하다는 의견에 동의해요! 👍🏻
구현 기능
관련 이슈