diff options
Diffstat (limited to 'Juick/Model/User.m')
-rw-r--r-- | Juick/Model/User.m | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/Juick/Model/User.m b/Juick/Model/User.m index 7f97e34..6d5e818 100644 --- a/Juick/Model/User.m +++ b/Juick/Model/User.m @@ -38,26 +38,4 @@ [view presentViewController:alert animated:YES completion:nil]; } -+(void) checkIsValid:(void (^)(BOOL))callback { - AFHTTPSessionManager *manager = [APIClient sharedClient].manager; - [manager POST:@"post" parameters:nil progress:nil success:nil failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - NSInteger statusCode = ((NSHTTPURLResponse *)task.response).statusCode; - if (statusCode == 400) { - callback(YES); - } else { - [manager.requestSerializer clearAuthorizationHeader]; - callback(NO); - } - }];} - -+(void) get:(NSString *) name callback:(void(^)(User *))callback { - AFHTTPSessionManager *manager = [APIClient sharedClient].manager; - NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:name, @"uname", nil]; - [manager GET:@"users" parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - callback([User fromJSON:[(NSArray *)responseObject firstObject]]); - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - callback(nil); - }]; -} - @end |