26 lines
711 B
Swift
26 lines
711 B
Swift
extension RostersState {
|
|
static func reducer(state: inout RostersState, action: RostersAction) {
|
|
switch action {
|
|
case .addRosterDone(let jid):
|
|
state.newAddedRosterJid = jid
|
|
state.newAddedRosterError = nil
|
|
|
|
case .addRosterError(let reason):
|
|
state.newAddedRosterJid = nil
|
|
state.newAddedRosterError = reason
|
|
|
|
case .rostersListUpdated(let rosters):
|
|
state.rosters = rosters
|
|
|
|
case .markRosterAsLocallyDeleted, .deleteRoster:
|
|
state.deleteRosterError = nil
|
|
|
|
case .rosterDeletingFailed(let reson):
|
|
state.deleteRosterError = reson
|
|
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
}
|