Skip to content

Commit

Permalink
fix: Return null if the SDK is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 10, 2020
1 parent b6b7578 commit 4f5eaa2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/useApiDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const useApiDoc = (name) => {
if (typeof window === 'undefined') global.window = {};

return useMemo(() => {
if (window.__NR1_SDK__ == null) {
return null;
}

const sdk = window.__NR1_SDK__?.default ?? {};
const api = sdk[name];

Expand Down Expand Up @@ -59,7 +63,7 @@ const useApiDoc = (name) => {
};
}),
};
}, [name, window?.__NR1_SDK__]);
}, [name, window.__NR1_SDK__]);
};

export default useApiDoc;

0 comments on commit 4f5eaa2

Please sign in to comment.