Skip to content

Instantly share code, notes, and snippets.

@enesozturk
Created July 2, 2021 09:33
Show Gist options
  • Save enesozturk/1bb9c20b60da566fe20c79d2b26ef2e0 to your computer and use it in GitHub Desktop.
Save enesozturk/1bb9c20b60da566fe20c79d2b26ef2e0 to your computer and use it in GitHub Desktop.

Revisions

  1. enesozturk created this gist Jul 2, 2021.
    25 changes: 25 additions & 0 deletions SingleSignOnCallback.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    import {useEffect} from 'react';

    import {useNavigation} from '@react-navigation/native';
    import {useDispatch} from 'react-redux';

    import {handleAuthenticateViaCognito} from 'actions';

    function SingleSignOnCallback({route}) {
    const {goBack} = useNavigation();
    const {id_token, authType} = route.params;
    const dispatch = useDispatch();

    useEffect(() => {
    dispatch(
    handleAuthenticateViaCognito(id_token, authType, () => {
    goBack();
    }),
    );
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, []);

    return null;
    }

    export default SingleSignOnCallback;