From 917fd3b930b8c25551b751608b9bd0dd104b56e5 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 19 Jan 2017 23:38:50 +0300 Subject: Handle changed password --- Juick/Model/Message.m | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Juick/Model') diff --git a/Juick/Model/Message.m b/Juick/Model/Message.m index a4bcd2c..a7934ac 100644 --- a/Juick/Model/Message.m +++ b/Juick/Model/Message.m @@ -8,6 +8,7 @@ #import "Message.h" #import "PDKeychainBindings.h" +#import "AppDelegate.h" @implementation Message @@ -34,6 +35,11 @@ callback(messages); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { NSLog(@"REST Error: %@", error); + NSInteger statusCode = ((NSHTTPURLResponse *)task.response).statusCode; + if (statusCode == 401) { + AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; + [appDelegate pushLoginForm]; + } }]; } -- cgit v1.2.3