import React, { Component } from 'react'
import pureRender from 'pure-render-decorator'

import '../../css/data-fetch-error.less'

@pureRender
export default class DataFetchError extends Component {
  renderUnauthorized() {
   return <div>
      Your are not authorized to access report data. Your access token might have expired.
      Please go back to Portal and launch report again.
    </div>
  }

  renderGenericInfo(error) {
    return (
      <div>
        <div>URL: {error.url}</div>
        <div>Status: {error.status}</div>
        <div>Status text: {error.statusText}</div>
      </div>
    )
  }

  renderError(error) {
    switch(error.status) {
      case 401:
        return this.renderUnauthorized()
      default:
        return this.renderGenericInfo(error)
    }
  }

  render() {
    const { error } = this.props
    return (
      <div className='data-fetch-error'>
        <h2>Report data download failed</h2>
        {this.renderError(error)}
      </div>
    )
  }
}

import React, { Component } from 'react'
import pureRender from 'pure-render-decorator'

import '../../css/data-fetch-error.less'

@pureRender
export default class DataFetchError extends Component {
  renderUnauthorized() {
   return <div>
      You are not authorized to access report data. Your access token might have expired.
      Please go back to Portal and launch report again.
    </div>
  }

  renderGenericInfo(error) {
    return (
      <div>
        <div>URL: {error.url}</div>
        <div>Status: {error.status}</div>
        <div>Status text: {error.statusText}</div>
      </div>
    )
  }

  renderError(error) {
    switch(error.status) {
      case 401:
        return this.renderUnauthorized()
      default:
        return this.renderGenericInfo(error)
    }
  }

  render() {
    const { error } = this.props
    return (
      <div className='data-fetch-error'>
        <h2>Report data download failed</h2>
        {this.renderError(error)}
      </div>
    )
  }
}

Fix typo in error message
Fix typo in error message

[#115369351]
