mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
20 lines
435 B
React
20 lines
435 B
React
|
import { useAuth } from 'react-oidc-context';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import React from 'react';
|
||
|
|
||
|
let isLoggingIn = true;
|
||
|
const OidcLogin = React.memo(({ onAuthenticate }) => {
|
||
|
const auth = useAuth();
|
||
|
if (isLoggingIn && auth.user) {
|
||
|
isLoggingIn = false;
|
||
|
const { user } = auth;
|
||
|
onAuthenticate(user);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
OidcLogin.propTypes = {
|
||
|
onAuthenticate: PropTypes.func.isRequired,
|
||
|
};
|
||
|
|
||
|
export default OidcLogin;
|