Skip to content

Instantly share code, notes, and snippets.

@tmkasun

tmkasun/Logout.jsx

Created Sep 4, 2020
Embed
What would you like to do?
Sample custom redirect
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
You can’t perform that action at this time.