Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Tidy up a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Aug 30, 2017
1 parent 333f0f0 commit 2efea7d
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions packages/api-explorer-ui/src/SecurityInput.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const React = require('react');
const PropTypes = require('prop-types');

function oauth2({ scheme, apiKey, oauthUrl }) {
function Oauth2({ scheme, apiKey, oauthUrl }) {
if (!apiKey && oauthUrl) {
return (
<section>
Expand Down Expand Up @@ -34,21 +34,29 @@ function oauth2({ scheme, apiKey, oauthUrl }) {
);
}

Oauth2.propTypes = {
scheme: PropTypes.shape({
type: PropTypes.string.isRequired,
}).isRequired,
apiKey: PropTypes.string,
};

Oauth2.defaultProps = {
apiKey: '',
};

function SecurityInput(props) {
switch (props.scheme.type) {
case 'oauth2':
return oauth2(props);
return Oauth2(props);
default: return <span />;
}
return <span />;
}

SecurityInput.propTypes = {
scheme: PropTypes.shape({}).isRequired,
apiKey: PropTypes.string,
};

SecurityInput.defaultProps = {
apiKey: '',
scheme: PropTypes.shape({
type: PropTypes.string.isRequired,
}).isRequired,
};

module.exports = SecurityInput;

0 comments on commit 2efea7d

Please sign in to comment.