1
This commit is contained in:
@@ -12,10 +12,12 @@
|
||||
#import "KBHUD.h"
|
||||
#import "KBBizCode.h"
|
||||
#import "KBAPI.h"
|
||||
#import "KBMyVM.h"
|
||||
|
||||
@interface KBHomeVM ()
|
||||
@property (nonatomic, copy, readwrite, nullable) NSArray<KBCharacter *> *rankList;
|
||||
@property (nonatomic, copy, readwrite, nullable) NSArray<KBTag *> *tagList;
|
||||
@property (nonatomic, strong) KBMyVM *myVM;
|
||||
@end
|
||||
|
||||
@implementation KBHomeVM
|
||||
@@ -208,10 +210,28 @@
|
||||
// }
|
||||
// }];
|
||||
[[KBNetworkManager shared] POST:API_CHARACTER_ADD_USER_CHARACTER jsonBody:params headers:nil autoShowBusinessError:false completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (!error) {
|
||||
[self refreshUserCharacterCacheForKeyboard];
|
||||
}
|
||||
if (completion) {
|
||||
completion(error == nil, error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)refreshUserCharacterCacheForKeyboard {
|
||||
[self.myVM fetchCharacterListByUserWithCompletion:^(NSArray<KBCharacter *> * _Nonnull characterArray, NSError * _Nullable error) {
|
||||
if (error) {
|
||||
NSLog(@"[KBHomeVM] refresh user characters failed: %@", error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (KBMyVM *)myVM {
|
||||
if (!_myVM) {
|
||||
_myVM = [[KBMyVM alloc] init];
|
||||
}
|
||||
return _myVM;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user