Add LoginMenu.tsx

This commit is contained in:
Jerko Steiner 2019-03-18 20:18:50 +05:00
parent 30a8c56119
commit c813407c95
4 changed files with 20 additions and 6 deletions

View File

@ -1,8 +1,9 @@
import React from 'react'
import {FaUser, FaLock} from 'react-icons/fa'
import {ICredentials, IUser} from '@rondo/common'
import {Input} from '../components/Input'
import {Link} from 'react-router-dom'
import {Redirect} from '../components/Redirect'
import {FaUser, FaLock} from 'react-icons/fa'
export interface ILoginFormProps {
error?: string
@ -47,6 +48,10 @@ export class LoginForm extends React.PureComponent<ILoginFormProps> {
type='submit'
value='Log In'
/>
<p>
Do not have an account? <Link to='/auth/register'>Register</Link>
</p>
</form>
)
}

View File

@ -20,7 +20,11 @@ export class ServerRenderer<State, A extends Action> implements IRenderer {
const context: StaticRouterContext = {}
const stream = renderToNodeStream(
<Provider store={store}>
<StaticRouter location={url} context={context} >
<StaticRouter
basename={config.baseUrl}
location={url}
context={context}
>
<RootComponent config={config} />
</StaticRouter>
</Provider>,

View File

@ -1,6 +1,9 @@
declare namespace Application {
export interface User {
id: number
username: string
firstName: string
lastName: string
}
}

View File

@ -8,12 +8,14 @@ export class RequestLogger implements IMiddleware {
handle: IHandler = (req, res, next) => {
const start = Date.now()
res.on('finish', () => {
const { method, originalUrl } = req
const { method, originalUrl, user } = req
const username = user ? user.username : ''
const duration = Date.now() - start
this.logger.debug('%s %s %j', method, originalUrl, req.body)
this.logger.debug('%s %s [%s] %j',
method, originalUrl, username, req.body)
const { statusCode } = res
this.logger.info('%s %s %d %sms',
method, originalUrl, statusCode, duration)
this.logger.info('%s %s [%s] %d %sms',
method, originalUrl, username, statusCode, duration)
})
next()
}