fix(chat-room): 쿼터 UI를 totalRemaining 대신 nextRechargeAtEpoch 기준으로 갱신
This commit is contained in:
@@ -121,7 +121,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
|
||||
if let data = decoded.data, decoded.success {
|
||||
self?.messages.append(contentsOf: data.messages)
|
||||
self?.updateQuota(totalRemaining: data.totalRemaining, nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
self?.updateQuota(nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
self?.errorMessage = message
|
||||
@@ -178,7 +178,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
self?.hasMoreMessages = data.hasMoreMessages
|
||||
self?.nextCursor = data.messages.last?.messageId
|
||||
|
||||
self?.updateQuota(totalRemaining: data.totalRemaining, nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
self?.updateQuota(nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
self?.errorMessage = message
|
||||
@@ -293,7 +293,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
let decoded = try jsonDecoder.decode(ApiResponse<ChatQuotaStatusResponse>.self, from: responseData)
|
||||
|
||||
if let data = decoded.data, decoded.success {
|
||||
self?.updateQuota(totalRemaining: data.totalRemaining, nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
self?.updateQuota(nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
|
||||
let can = UserDefaults.int(forKey: .can)
|
||||
UserDefaults.set(can - 30, forKey: .can)
|
||||
@@ -418,7 +418,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
let decoded = try jsonDecoder.decode(ApiResponse<ChatQuotaStatusResponse>.self, from: responseData)
|
||||
|
||||
if let data = decoded.data, decoded.success {
|
||||
self?.updateQuota(totalRemaining: data.totalRemaining, nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
self?.updateQuota(nextRechargeAtEpoch: data.nextRechargeAtEpoch)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
self?.errorMessage = message
|
||||
@@ -439,7 +439,7 @@ final class ChatRoomViewModel: ObservableObject {
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
private func updateQuota(totalRemaining: Int, nextRechargeAtEpoch: Int64?) {
|
||||
private func updateQuota(nextRechargeAtEpoch: Int64?) {
|
||||
isLoading = true
|
||||
stopTimer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user