Created
September 4, 2020 15:13
-
-
Save tmkasun/ee304b2437b2d76fc287b79a5b5e3937 to your computer and use it in GitHub Desktop.
Sample custom redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import User from '../data/User'; | |
import Utils from '../data/Utils'; | |
/** | |
* Logout component | |
* @class Logout | |
* @extends {Component} Logout component | |
*/ | |
class Logout extends Component { | |
/** | |
* Component Mounted Lifecycle call back | |
* | |
* @memberof Logout | |
*/ | |
componentDidMount() { | |
const environmentName = Utils.getEnvironment().label; | |
localStorage.removeItem(`${User.CONST.LOCALSTORAGE_USER}_${environmentName}`); | |
if (typeof window !== 'undefined') { | |
window.location.href = "http://foo.com/customError"; | |
} | |
} | |
/** | |
* Main render method | |
* | |
* @returns {JSX} | |
* @memberof Logout | |
*/ | |
render() { | |
// https://reactjs.org/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | |
return null; | |
} | |
} | |
export default Logout; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment