크리에이터 커뮤니티 게시물

- 이미지가 없어도 등록할 수 있도록 수정
- 유효성 검사 추가
- 크리에이터 채널 - 게시물 높이가 같을 수 있도록 이미지가 없으면 Rectangle 추가
This commit is contained in:
Yu Sung 2023-12-20 00:39:29 +09:00
parent d829399b05
commit 28b64ba8a8
2 changed files with 10 additions and 5 deletions

View File

@ -45,6 +45,10 @@ struct CreatorCommunityItemView: View {
.resizable() .resizable()
.frame(width: 53.3, height: 53.3) .frame(width: 53.3, height: 53.3)
.cornerRadius(4.7) .cornerRadius(4.7)
} else {
Rectangle()
.foregroundColor(Color(hex: "222222").opacity(0))
.frame(width: 53.3, height: 53.3)
} }
} }

View File

@ -45,11 +45,6 @@ final class CreatorCommunityWriteViewModel: ObservableObject {
fileName: "\(UUID().uuidString)_\(Date().timeIntervalSince1970 * 1000).jpg", fileName: "\(UUID().uuidString)_\(Date().timeIntervalSince1970 * 1000).jpg",
mimeType: "image/*") mimeType: "image/*")
) )
} else {
errorMessage = "이미지를 업로드 하지 못했습니다.\n다시 선택해 주세요"
isShowPopup = true
isLoading = false
return
} }
multipartData.append(MultipartFormData(provider: .data(jsonData), name: "request")) multipartData.append(MultipartFormData(provider: .data(jsonData), name: "request"))
@ -103,6 +98,12 @@ final class CreatorCommunityWriteViewModel: ObservableObject {
} }
private func validateData() -> Bool { private func validateData() -> Bool {
if content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || content.count < 5 {
errorMessage = "내용을 5자 이상 입력해 주세요."
isShowPopup = true
return false
}
return true return true
} }
} }