0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

Merge pull request #320 from ayusharma/issue-319

Load logo from config
This commit is contained in:
Juan Picado @jotadeveloper 2017-09-13 11:34:46 +02:00 committed by GitHub
commit e81d50162f
2 changed files with 16 additions and 6 deletions

View file

@ -32,9 +32,8 @@ module.exports = function(config, auth, storage) {
}); });
}); });
router.get('/-/logo', function(req, res) { router.get('/-/verdaccio/logo', function(req, res) {
res.sendFile(_.get(config, 'web.logo') || `${env.APP_ROOT}/static/logo-sm.png` res.send(_.get(config, 'web.logo') || '/-/static/logo.png');
);
}); });
router.get('/', function(req, res) { router.get('/', function(req, res) {

View file

@ -10,13 +10,14 @@ import storage from '../../../utils/storage';
import classes from './header.scss'; import classes from './header.scss';
import logo from './logo.png'; import './logo.png';
export default class Header extends React.Component { export default class Header extends React.Component {
state = { state = {
showLogin: false, showLogin: false,
username: '', username: '',
password: '' password: '',
logo: ''
} }
constructor(props) { constructor(props) {
@ -37,6 +38,16 @@ export default class Header extends React.Component {
}); });
} }
componentWillMount() {
API.get('logo')
.then((response) => {
this.setState({logo: response.data});
})
.catch((error) => {
throw new Error(error);
});
}
async handleSubmit() { async handleSubmit() {
if (this.state.username === '' || this.state.password === '') { if (this.state.username === '' || this.state.password === '') {
return MessageBox.alert('Username or password can\'t be empty!', ''); return MessageBox.alert('Username or password can\'t be empty!', '');
@ -120,7 +131,7 @@ export default class Header extends React.Component {
<header className={ classes.header }> <header className={ classes.header }>
<div className={ classes.headerWrap }> <div className={ classes.headerWrap }>
<Link to="/"> <Link to="/">
<img src={ logo } className={ classes.logo } /> <img src={ this.state.logo } className={ classes.logo } />
</Link> </Link>
<figure> <figure>
npm set registry { location.origin } npm set registry { location.origin }