1234567891011121314151617181920212223242526272829303132333435363738 |
- //
- // XYMyVoiceRoomListViewModel.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/7/7.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "XYMyVoiceRoomListViewModel.h"
- #import "XYMyVoiceRoomListModel.h"
- @implementation XYMyVoiceRoomListViewModel
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- self.shouldPullDownToRefresh = YES;
- }
- return self;
- }
- - (void)loadData:(SuccessHandler)success failure:(FailureHandler)failure {
-
- [[XYVoiceRoomAPIManager new] getMyRoomsSuccessHandler:^(ZYLResponseModel *responseModel) {
- [self.dataSource removeAllObjects];
- for (NSDictionary *dict in responseModel.data[@"list"]) {
- XYMyVoiceRoomListModel *model = XYMyVoiceRoomListModel.new;
- [model yy_modelSetWithDictionary:dict];
- [self.dataSource addObject:model];
- }
- !success?:success(self.dataSource);
- } failureHandler:^(ZYLNetworkError *error) {
- !failure?:failure(error);
- }];
- }
- @end
|