From 86a10afce6f621b7720bec67e0cb0ca9a9403efb Mon Sep 17 00:00:00 2001 From: Yury Chebotaev Date: Mon, 17 Jun 2019 06:59:34 +0500 Subject: [PATCH] Add flag enableRunRoutes --- src/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 322c16b..b523660 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -99,7 +99,8 @@ export function IdentityContextProvider({ /** some people may want to use this as a hook and bring their own contexts */ export function useNetlifyIdentity( url: string, - onAuthChange: authChangeParam = () => {} + onAuthChange: authChangeParam = () => {}, + enableRunRoutes: boolean = true ): ReactNetlifyIdentityAPI { const goTrueInstance = new GoTrue({ APIUrl: `${url}/.netlify/identity`, @@ -116,7 +117,9 @@ export function useNetlifyIdentity( }; React.useEffect(() => { - runRoutes(goTrueInstance, _setUser); + if (enableRunRoutes) { + runRoutes(goTrueInstance, _setUser); + } }, []); /******* OPERATIONS */