components/Modals/SessionExpired.js

/**
 * @module Modals/SessionExpired
 */
import React, { Component } from 'react';
import SVGComponent from '../SVG/SVGComponent';
import { SVG_ICONS } from '../../constants';
/**
 * @typedef {object} props
 * @property {object} destinations
 * @property {Function} goToLogin
 */

/**
 * Render
 *
 * @param {props} props
 * @returns {view}
 */
export default class SessionExpired extends Component {
  componentDidMount() {
    // do logout on session experired to clear previous app state
    this.props.logoutRequest({ isSessionBreak: true });
  }

  /**
   * Render
   *
   * @returns {view}
   */
  render() {
    return (
      <div className="loader">
        <div className="session">
          <h3>Session Expired</h3>
          <div className="btn-holder">
            <button
              type="button"
              className="btn btn-primary"
              onClick={this.props.goToLogin}
            >
              Login
            </button>
            <a className="btn btn-primary" href={this.props.destinations.home}>
              Back to Bet9ja
              <SVGComponent
                className="icon-m arrow-left"
                src={`${SVG_ICONS.utility}#icon__arrow`}
              />
            </a>
          </div>
        </div>
      </div>
    );
  }
}