mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
stub in test label mutation
This commit is contained in:
parent
dcc7924531
commit
72438d2d97
1 changed files with 21 additions and 12 deletions
|
|
@ -25,19 +25,23 @@ final class LabelsViewModel: ObservableObject {
|
|||
.store(in: &subscriptions)
|
||||
}
|
||||
|
||||
func createLabel(dataService _: DataService) {
|
||||
func createLabel(dataService: DataService, name: String, color: String, description: String?) {
|
||||
isLoading = true
|
||||
|
||||
// dataService.createNewsletterEmailPublisher().sink(
|
||||
// receiveCompletion: { [weak self] _ in
|
||||
// self?.isLoading = false
|
||||
// },
|
||||
// receiveValue: { [weak self] result in
|
||||
// self?.isLoading = false
|
||||
// self?.emails.insert(result, at: 0)
|
||||
// }
|
||||
// )
|
||||
// .store(in: &subscriptions)
|
||||
dataService.createLabelPublisher(
|
||||
name: name,
|
||||
color: color,
|
||||
description: description
|
||||
).sink(
|
||||
receiveCompletion: { [weak self] _ in
|
||||
self?.isLoading = false
|
||||
},
|
||||
receiveValue: { [weak self] result in
|
||||
self?.isLoading = false
|
||||
self?.labels.insert(result, at: 0)
|
||||
}
|
||||
)
|
||||
.store(in: &subscriptions)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +71,12 @@ struct LabelsView: View {
|
|||
Section(footer: Text(footerText)) {
|
||||
Button(
|
||||
action: {
|
||||
viewModel.createLabel(dataService: dataService)
|
||||
viewModel.createLabel(
|
||||
dataService: dataService,
|
||||
name: "ios-test",
|
||||
color: "#F9D354",
|
||||
description: "hardcoded test label"
|
||||
)
|
||||
},
|
||||
label: {
|
||||
HStack {
|
||||
|
|
|
|||
Loading…
Reference in a new issue