룰렛 설정 - 설정된 적이 없을 때 기본 캔 설정 5 -> 0으로 변경
This commit is contained in:
		| @@ -17,7 +17,7 @@ final class RouletteSettingsViewModel: ObservableObject { | ||||
|     @Published var errorMessage = "" | ||||
|     @Published var isShowErrorPopup = false | ||||
|      | ||||
|     @Published var canText = ""{ | ||||
|     @Published var canText = "" { | ||||
|         didSet { | ||||
|             can = Int(canText) ?? 0 | ||||
|         } | ||||
| @@ -34,7 +34,7 @@ final class RouletteSettingsViewModel: ObservableObject { | ||||
|     } | ||||
|     @Published var previewData: RoulettePreview? = nil | ||||
|      | ||||
|     var can = 5 | ||||
|     var can = 0 | ||||
|      | ||||
|     func plusWeight(index: Int) { | ||||
|         options[index].weight += 1 | ||||
| @@ -103,7 +103,13 @@ final class RouletteSettingsViewModel: ObservableObject { | ||||
|                      | ||||
|                     if let data = decoded.data, decoded.success { | ||||
|                         self.isActive = data.isActive | ||||
|                         self.canText = String(data.can) | ||||
|                          | ||||
|                         if data.can > 0 { | ||||
|                             self.canText = String(data.can) | ||||
|                         } else { | ||||
|                             self.canText = "" | ||||
|                         } | ||||
|                          | ||||
|                         if !data.items.isEmpty { | ||||
|                             let options = data.items.map { | ||||
|                                 RouletteOption(title: $0.title, weight: $0.weight) | ||||
| @@ -116,7 +122,7 @@ final class RouletteSettingsViewModel: ObservableObject { | ||||
|                         } | ||||
|                     } else { | ||||
|                         self.isActive = false | ||||
|                         self.canText = "5" | ||||
|                         self.canText = "" | ||||
|                         self.addOption() | ||||
|                         self.addOption() | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung