Skip to content

Commit b3b7ba2

Browse files
committed
Code review changes suggested by @AugustoRamos94:
- Removed unnecessary 'return' - Checking for error instead of checking value before calling error callback
1 parent d2e1bf0 commit b3b7ba2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m

+1-3
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ - (void)body_getLatestPeakFlow:(NSDictionary *)input callback:(RCTResponseSender
305305
[self fetchMostRecentQuantitySampleOfType:peakFlowType
306306
predicate:nil
307307
completion:^(HKQuantity *mostRecentQuantity, NSDate *startDate, NSDate *endDate, NSError *error) {
308-
if (!mostRecentQuantity) {
308+
if (error) {
309309
NSLog(@"error getting latest peak flow: %@", error);
310310
callback(@[RCTMakeError(@"error getting latest peak flow", error, nil)]);
311311
}
@@ -348,10 +348,8 @@ - (void)body_getPeakFlowSamples:(NSDictionary *)input callback:(RCTResponseSende
348348
completion:^(NSArray *results, NSError *error) {
349349
if(results){
350350
callback(@[[NSNull null], results]);
351-
return;
352351
} else {
353352
callback(@[RCTJSErrorFromNSError(error)]);
354-
return;
355353
}
356354
}];
357355
}

0 commit comments

Comments
 (0)