mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[functions] useFunctionsEmulator now stores origin in JS to be sent with each httpsCallable for that instance
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
(FIRApp *) firebaseApp
|
||||
region:
|
||||
(NSString *) region
|
||||
origin:
|
||||
(NSString *) origin
|
||||
name:
|
||||
(NSString *) name
|
||||
wrapper:
|
||||
@@ -45,6 +47,11 @@
|
||||
(RCTPromiseRejectBlock) reject
|
||||
) {
|
||||
FIRFunctions *functions = [FIRFunctions functionsForApp:firebaseApp region:region];
|
||||
|
||||
if (origin != nil) {
|
||||
[functions useFunctionsEmulatorOrigin:origin];
|
||||
}
|
||||
|
||||
FIRHTTPSCallable *callable = [functions HTTPSCallableWithName:name];
|
||||
|
||||
[callable callWithObject:[wrapper valueForKey:@"data"] completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
|
||||
@@ -70,22 +77,6 @@
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(useFunctionsEmulator:
|
||||
(FIRApp *) firebaseApp
|
||||
region:
|
||||
(NSString *) region
|
||||
origin:
|
||||
(NSString *) origin
|
||||
resolver:
|
||||
(RCTPromiseResolveBlock) resolve
|
||||
rejecter:
|
||||
(RCTPromiseRejectBlock) reject
|
||||
) {
|
||||
FIRFunctions *functions = [FIRFunctions functionsForApp:firebaseApp region:region];
|
||||
[functions useFunctionsEmulatorOrigin:origin];
|
||||
resolve([NSNull null]);
|
||||
}
|
||||
|
||||
- (NSString *)getErrorCodeName:(NSError *)error {
|
||||
NSString *code = @"UNKNOWN";
|
||||
switch (error.code) {
|
||||
|
||||
Reference in New Issue
Block a user