diff --git a/.changeset/thick-eagles-camp.md b/.changeset/thick-eagles-camp.md new file mode 100644 index 0000000..e3f8f99 --- /dev/null +++ b/.changeset/thick-eagles-camp.md @@ -0,0 +1,5 @@ +--- +"@asgardeo/react": patch +--- + +Expose global loading state from the react SDK diff --git a/packages/react/src/hooks/use-authentication.ts b/packages/react/src/hooks/use-authentication.ts index e0beac0..43802cf 100644 --- a/packages/react/src/hooks/use-authentication.ts +++ b/packages/react/src/hooks/use-authentication.ts @@ -32,7 +32,7 @@ import UseAuthentication from '../models/use-authentication'; const useAuthentication = (): UseAuthentication => { const contextValue: AuthContext = useContext(AsgardeoContext); - const {accessToken, authResponse, isAuthenticated, setUsername, user, username} = contextValue; + const {accessToken, authResponse, isAuthenticated, isGlobalLoading, setUsername, user, username} = contextValue; const signOut: () => void = () => { signOutApiCall().then(() => { @@ -47,6 +47,7 @@ const useAuthentication = (): UseAuthentication => { accessToken, authResponse, isAuthenticated, + isGlobalLoading, setUsername, signOut, user, diff --git a/packages/react/src/models/use-authentication.ts b/packages/react/src/models/use-authentication.ts index 9d6dc59..ac52bd8 100644 --- a/packages/react/src/models/use-authentication.ts +++ b/packages/react/src/models/use-authentication.ts @@ -22,6 +22,7 @@ interface UseAuthentication { accessToken: string; authResponse: AuthApiResponse; isAuthenticated: Promise | boolean; + isGlobalLoading: boolean; setUsername: (username: string) => void; signOut: () => void; user: MeAPIResponse;