Commit 554abcb1 by Brent Gulanowski

Pass the customer access token to callbacks after login and renew.

parent 1cc02e5b
...@@ -55,7 +55,7 @@ typedef void (^BUYDataCustomerTokenBlock)(BUYCustomer * _Nullable customer, BUYC ...@@ -55,7 +55,7 @@ typedef void (^BUYDataCustomerTokenBlock)(BUYCustomer * _Nullable customer, BUYC
* @param token An authentication token to retrieve the customer later. Store this token securely on the device. * @param token An authentication token to retrieve the customer later. Store this token securely on the device.
* @param error An optional NSError * @param error An optional NSError
*/ */
typedef void (^BUYDataTokenBlock)(NSString * _Nullable token, NSError * _Nullable error); typedef void (^BUYDataTokenBlock)(BUYCustomerToken * _Nullable token, NSError * _Nullable error);
/** /**
* Return block containing an array of BUYOrders * Return block containing an array of BUYOrders
......
...@@ -118,13 +118,12 @@ ...@@ -118,13 +118,12 @@
NSURL *url = [self urlForCustomersTokenRenewal]; NSURL *url = [self urlForCustomersTokenRenewal];
return [self putRequestForURL:url object:nil completionHandler:^(NSDictionary *json, NSHTTPURLResponse *response, NSError *error) { return [self putRequestForURL:url object:nil completionHandler:^(NSDictionary *json, NSHTTPURLResponse *response, NSError *error) {
NSString *accessToken = nil; BUYCustomerToken *customerToken = nil;
if (json && !error) { if (json && !error) {
BUYCustomerToken *customerToken = [BUYCustomerToken customerTokenWithJSON:json]; customerToken = [BUYCustomerToken customerTokenWithJSONDictionary:json];
accessToken = customerToken.accessToken;
} }
block(accessToken, error); block(customerToken, error);
}]; }];
} }
else { else {
......
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