TokenView.jsx 1.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
import React, { PureComponent } from 'react'
import {Navbar, Nav, NavItem, NavDropdown, MenuItem, Glyphicon, Jumbotron, Button} from 'react-bootstrap'
import {Row, Col, Collapse, FormControl, FormGroup, ControlLabel, HelpBlock, PanelGroup, Panel} from 'react-bootstrap'

import HostnameController from '../containers/HostnameController'
import ServerConfigController from '../containers/ServerConfigController'
import WhiteBox from './WhiteBox'


import moment from 'moment'
import 'moment/locale/nb';
// import 'moment/locale/en';

moment.locale("en");


export function expiresText(expires) {
  var expiresM = moment.unix(expires)
  return expiresM.fromNow()
}

class Component extends PureComponent {

  render() {
    console.error("Component", this.props)

    if (!this.props.token) {
      return (
        <p>No token</p>
      )
    }

    let extxt = expiresText(this.props.token.expires)

    return (
      <Panel header="Access Token" eventKey="1" collapsible={true} expanded={true}>

        <p>This access token expires {extxt}</p>
        <pre>{this.props.tokenstring}</pre>

      </Panel>
    )
  }


}

export default Component