Skip to content

Commit

Permalink
Fix component prop type validation to use elementType
Browse files Browse the repository at this point in the history
  • Loading branch information
cheets committed Oct 14, 2019
1 parent 3b0ccc1 commit 6ed0fc1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions packages/context/README.md
Expand Up @@ -49,10 +49,10 @@ render(<App />, document.getElementById('root'));

```javascript
const propTypes = {
notAuthenticated: PropTypes.node, // react component displayed during authentication
notAuthorized: PropTypes.node, // react component displayed in case user is not Authorised
authenticating: PropTypes.node, // react component displayed when about to redirect user to be authenticated
callbackComponentOverride: PropTypes.node, // react component displayed when user is connected
notAuthenticated: PropTypes.elementType, // react component displayed during authentication
notAuthorized: PropTypes.elementType, // react component displayed in case user is not Authorised
authenticating: PropTypes.elementType, // react component displayed when about to redirect user to be authenticated
callbackComponentOverride: PropTypes.elementType, // react component displayed when user is connected
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired, // oidc client configuration, the same as oidc client library used internally https://github.com/IdentityModel/oidc-client-js
redirect_uri: PropTypes.string.isRequired,
Expand Down
Expand Up @@ -9,10 +9,10 @@ import withServices from '../withServices';
export const AuthenticationContext = React.createContext(null);

const propTypes = {
notAuthenticated: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthorized: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
authenticating: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
authenticating: PropTypes.elementType,
callbackComponentOverride: PropTypes.elementType,
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired,
redirect_uri: PropTypes.string.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/routes/OidcRoutes.js
Expand Up @@ -5,8 +5,8 @@ import { getPath } from './route-utils';
import { SilentCallback } from '../callbacks';

const propTypes = {
notAuthenticated: PropTypes.node,
notAuthorized: PropTypes.node,
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
callbackComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired,
configuration: PropTypes.shape({
redirect_uri: PropTypes.string.isRequired,
Expand Down
6 changes: 3 additions & 3 deletions packages/redux/README.md
Expand Up @@ -72,9 +72,9 @@ The optional parameter "isEnabled" allows you to enable or disable authenticatio

```javascript
const propTypes = {
notAuthenticated: PropTypes.node, // react component displayed during authentication
callbackComponentOverride: PropTypes.node, // react component displayed when user is connected
notAuthorized: PropTypes.node, // react component displayed in case user is not Authorised
notAuthenticated: PropTypes.elementType, // react component displayed during authentication
callbackComponentOverride: PropTypes.elementType, // react component displayed when user is connected
notAuthorized: PropTypes.elementType, // react component displayed in case user is not Authorised
configuration: PropTypes.shape({
client_id: PropTypes.string.isRequired, // oidc client configuration, the same as oidc client library used internally https://github.com/IdentityModel/oidc-client-js
redirect_uri: PropTypes.string.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion packages/redux/src/AuthenticationCallback.js
Expand Up @@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
const propTypes = {
history: PropTypes.object.isRequired,
userManager: PropTypes.object.isRequired,
callbackComponentOverride: PropTypes.node,
callbackComponentOverride: PropTypes.elementType,
};

const defaultProps = {
Expand Down
6 changes: 3 additions & 3 deletions packages/redux/src/Oidc.js
Expand Up @@ -6,13 +6,13 @@ import { OidcRoutes, authenticationService, getUserManager } from '@axa-fr/react
import AuthenticationCallback from './AuthenticationCallback';

const propTypes = {
notAuthenticated: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthorized: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
notAuthenticated: PropTypes.elementType,
notAuthorized: PropTypes.elementType,
configuration: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
isEnabled: PropTypes.bool,
children: PropTypes.node,
callbackComponentOverride: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
callbackComponentOverride: PropTypes.elementType,
};

const defaultPropsObject = {
Expand Down

0 comments on commit 6ed0fc1

Please sign in to comment.