Commit f877d8f2 by lee

u

parent 4a6dc266
...@@ -375,10 +375,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -375,10 +375,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
[manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) { [manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) {
NSString *url = request.URL.absoluteString; NSString *url = request.URL.absoluteString;
if ([url isEqualToString:[NSString stringWithFormat:@"https://%@/account",Shopify_SHOP_DOMAIN]]) { if ([url isEqualToString:[NSString stringWithFormat:@"https://%@/account",Shopify_SHOP_DOMAIN]]) {
success(); if(success) success();
}else{ }else{
NSError *error = [[NSError alloc] initWithDomain:url code:401 userInfo:@{NSLocalizedDescriptionKey:@"email & password is invalid !"}]; NSError *error = [[NSError alloc] initWithDomain:url code:401 userInfo:@{NSLocalizedDescriptionKey:@"email & password is invalid !"}];
failure(error); if(failure) failure(error);
} }
return nil; return nil;
}]; }];
...@@ -391,7 +391,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -391,7 +391,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
}; };
[manager POST:loginUrl parameters:param success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { [manager POST:loginUrl parameters:param success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failure(error); if(failure) failure(error);
}]; }];
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
@implementation KWMHomeVC @implementation KWMHomeVC
+(NSString *)kwmTag{ + (NSString *)kwmTag{
return @"KWMHomeVC"; return @"KWMHomeVC";
} }
...@@ -43,13 +43,7 @@ ...@@ -43,13 +43,7 @@
[super viewDidLoad]; [super viewDidLoad];
_dataArr = [NSArray array]; _dataArr = [NSArray array];
[self requestBlogAPI]; [self requestBlogAPI];
[self.api loginWebSuccess:^{ [self.api loginWebSuccess:nil failure:nil];
// [[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
//
// }];
} failure:^(NSError *error) {
}];
} }
- (UITableView *)targetTableView{ - (UITableView *)targetTableView{
......
...@@ -192,6 +192,7 @@ ...@@ -192,6 +192,7 @@
//异步保存数据 //异步保存数据
dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self.api loginWebSuccess:nil failure:nil];
[self saveData]; [self saveData];
}); });
// NSString *path = NSHomeDirectory(); // NSString *path = NSHomeDirectory();
......
...@@ -441,6 +441,7 @@ ...@@ -441,6 +441,7 @@
NSLog(@"登录成功"); NSLog(@"登录成功");
//异步保存数据 //异步保存数据
dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self.api loginWebSuccess:nil failure:nil];
[self saveData]; [self saveData];
}); });
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment