another.im-ios/old/AppCore/Reducers/RostersReducer.swift

26 lines
711 B
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
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
}
}
}