ducky/web
ducky/web/src/pages/login.jsx
Update our profile model to use our refresh helper. Update our profile model to send the correct authorization header when making requests, and if the request fails because the OAuth token has expired, try to use the refresh token to obtain a new access token, then retry the request.
1 import app from 'ampersand-app'
2 import React from 'react'
3 import localLinks from 'local-links'
4 import LaddaButton from 'react-ladda'
5 import LaddaCSS from '../../node_modules/ladda/dist/ladda.min.css'
6 import HeroUnit from '../components/hero'
7 import onboardingStyles from '../styles/onboarding.scss'
9 export default React.createClass({
10 displayName: 'LoginPage',
12 getInitialState () {
13 return {active: false, progress: 0}
14 },
16 toggle () {
17 this.setState({active: !this.state.active})
18 },
20 onBackClick (event) {
21 event.preventDefault()
22 window.history.back()
23 },
25 render () {
26 return (
27 <div className='container'>
28 <HeroUnit title='Welcome Back'>We missed you.</HeroUnit>
29 <article className='onboarding login'>
30 <form>
31 <div>
32 <label htmlFor='emailLoginInput'>Email</label>
33 <input id='emailLoginInput' type='email'/>
35 <label htmlFor='passwordLoginInput'>Passphrase</label>
36 <input id='passwordLoginInput' type='password'/>
38 </div>
39 </form>
40 <div className='actionbuttons'>
41 <button onClick={this.onBackClick}>Back</button>
42 <LaddaButton style='expand-right' active={this.state.active} progress={this.state.progress}>
43 <button onClick={this.toggle} className='primary'>Login</button>
44 </LaddaButton>
45 </div>
46 </article>
47 </div>
48 )
49 }
50 })