34 lines
1.0 KiB
Objective-C
34 lines
1.0 KiB
Objective-C
//
|
|
// KBMyVM.m
|
|
// keyBoard
|
|
//
|
|
// Created by Mac on 2025/12/3.
|
|
//
|
|
|
|
#import "KBMyVM.h"
|
|
#import "AppDelegate.h"
|
|
|
|
@implementation KBMyVM
|
|
- (void)logout{
|
|
[KBHUD show];
|
|
[[KBNetworkManager shared] GET:API_LOGOUT parameters:nil headers:nil completion:^(NSDictionary * jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
|
if (error != nil) {
|
|
return;
|
|
}
|
|
NSString *message = jsonOrData[KBMessage];
|
|
// if (code == KBBizCodeSuccess) {
|
|
[KBHUD showSuccess:message];
|
|
[[KBUserSessionManager shared] logout];
|
|
// 登录成功后切换到主 TabBar
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
id<UIApplicationDelegate> appDelegate = UIApplication.sharedApplication.delegate;
|
|
if ([appDelegate respondsToSelector:@selector(setupRootVC)]) {
|
|
AppDelegate *delegate = (AppDelegate *)appDelegate;
|
|
[delegate setupRootVC];
|
|
}
|
|
});
|
|
// }
|
|
}];
|
|
}
|
|
@end
|