Skip to content

Commit

Permalink
fix: always return an object for getManagedConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
enahum committed Aug 23, 2020
1 parent 4630471 commit b00737a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type RNEmmType = {

exitApp(): void;

getManagedConfig(): Promise<any>;
getManagedConfig(): Promise<Record<string, any>>;

isDeviceSecured(): Promise<boolean>;

Expand All @@ -45,7 +45,7 @@ const { RNEmm } = NativeModules;

const emitter =
Platform.OS === 'ios' ? new NativeEventEmitter(RNEmm) : DeviceEventEmitter;
let cachedConfig: any = {};
let cachedConfig: Record<string, any> = {};

export default {
...RNEmm,
Expand Down Expand Up @@ -79,7 +79,10 @@ export default {
return cachedConfig;
}

cachedConfig = await RNEmm.getManagedConfig();
const managed = await RNEmm.getManagedConfig();
if (managed) {
cachedConfig = managed;
}

return cachedConfig;
},
Expand Down

0 comments on commit b00737a

Please sign in to comment.