fix(chat-room): 채팅방
- 쿼터 상태 조회, 쿼터 구매 API URL 변경
This commit is contained in:
@@ -51,12 +51,12 @@ class ChatRoomRepository {
|
||||
}
|
||||
|
||||
/** 쿼터 상태 조회 */
|
||||
func getChatQuotaStatus() -> AnyPublisher<Response, MoyaError> {
|
||||
return talkApi.requestPublisher(.getChatQuotaStatus)
|
||||
func getChatQuotaStatus(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return talkApi.requestPublisher(.getChatQuotaStatus(roomId: roomId))
|
||||
}
|
||||
|
||||
func purchaseChatQuota() -> AnyPublisher<Response, MoyaError> {
|
||||
return talkApi.requestPublisher(.purchaseChatQuota(request: ChatQuotaPurchaseRequest()))
|
||||
func purchaseChatQuota(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return talkApi.requestPublisher(.purchaseChatQuota(roomId: roomId, request: ChatQuotaPurchaseRequest()))
|
||||
}
|
||||
|
||||
func resetChatRoom(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
|
||||
@@ -277,7 +277,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
func purchaseChatQuota() {
|
||||
isLoading = true
|
||||
|
||||
repository.purchaseChatQuota()
|
||||
repository.purchaseChatQuota(roomId: roomId)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
@@ -402,7 +402,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
private func checkQuotaStatus() {
|
||||
isLoading = true
|
||||
|
||||
repository.getChatQuotaStatus()
|
||||
repository.getChatQuotaStatus(roomId: roomId)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
|
||||
@@ -15,8 +15,8 @@ enum TalkApi {
|
||||
case sendMessage(roomId: Int, request: SendChatMessageRequest)
|
||||
case getChatRoomMessages(roomId: Int, cursor: Int?, limit: Int)
|
||||
|
||||
case getChatQuotaStatus
|
||||
case purchaseChatQuota(request: ChatQuotaPurchaseRequest)
|
||||
case getChatQuotaStatus(roomId: Int)
|
||||
case purchaseChatQuota(roomId: Int, request: ChatQuotaPurchaseRequest)
|
||||
|
||||
case purchaseMessage(roomId: Int, messageId: Int64, request: ChatMessagePurchaseRequest)
|
||||
case resetChatRoom(roomId: Int, request: ChatRoomResetRequest)
|
||||
@@ -42,11 +42,11 @@ extension TalkApi: TargetType {
|
||||
case .getChatRoomMessages(let roomId, _, _):
|
||||
return "/api/chat/room/\(roomId)/messages"
|
||||
|
||||
case .getChatQuotaStatus:
|
||||
return "/api/chat/quota/me"
|
||||
case .getChatQuotaStatus(let roomId):
|
||||
return "/api/chat/rooms/\(roomId)/quota/me"
|
||||
|
||||
case .purchaseChatQuota:
|
||||
return "/api/chat/quota/purchase"
|
||||
case .purchaseChatQuota(let roomId, _):
|
||||
return "/api/chat/rooms/\(roomId)/quota/purchase"
|
||||
|
||||
case .purchaseMessage(let roomId, let messageId, _):
|
||||
return "/api/chat/room/\(roomId)/messages/\(messageId)/purchase"
|
||||
@@ -125,7 +125,7 @@ extension TalkApi: TargetType {
|
||||
case .getChatQuotaStatus:
|
||||
return .requestPlain
|
||||
|
||||
case .purchaseChatQuota(let request):
|
||||
case .purchaseChatQuota(_, let request):
|
||||
return .requestJSONEncodable(request)
|
||||
|
||||
case .purchaseMessage(_, _, let request):
|
||||
|
||||
Reference in New Issue
Block a user