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

Fix: Issue #319 Load logo from config

Review: catch block
This commit is contained in:
Ayush Sharma 2017-09-12 00:28:43 +05:30
parent da7aaf3ec4
commit 2442571e2f
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) {
res.sendFile(_.get(config, 'web.logo') || `${env.APP_ROOT}/static/logo-sm.png`
);
router.get('/-/verdaccio/logo', function(req, res) {
res.send(_.get(config, 'web.logo') || '/-/static/logo.png');
});
router.get('/', function(req, res) {

View file

@ -10,13 +10,14 @@ import storage from '../../../utils/storage';
import classes from './header.scss';
import logo from './logo.png';
import './logo.png';
export default class Header extends React.Component {
state = {
showLogin: false,
username: '',
password: ''
password: '',
logo: ''
}
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() {
if (this.state.username === '' || this.state.password === '') {
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 }>
<div className={ classes.headerWrap }>
<Link to="/">
<img src={ logo } className={ classes.logo } />
<img src={ this.state.logo } className={ classes.logo } />
</Link>
<figure>
npm set registry { location.origin }