forked from hasura/auth-ui-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogout.js
82 lines (78 loc) · 2.19 KB
/
Logout.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React, { Component } from 'react';
import { Helmet } from 'react-helmet';
import { logoutGlobal } from './api';
import globals from './globals';
import './style.css';
class Logout extends Component {
state = {
logoutMsg: 'Logging out...',
inProgress: true,
};
componentDidMount() {
const logoutTrigger = logoutGlobal();
const this_ = this;
logoutTrigger.then(function(data) {
this_.setState({ logoutMsg: data.message, inProgress: false });
const currentLocation = window.location;
let redirectUrl = decodeURIComponent(
currentLocation.search.split('=')[1]
);
if (
redirectUrl !== undefined &&
redirectUrl !== 'undefined' &&
redirectUrl !== null
) {
window.location.href = redirectUrl;
}
});
}
render() {
const pageWrapperThemeClass =
globals.theme === 'light'
? 'LightLandingPageWrapper'
: 'DarkLandingPageWrapper';
const pageInnerThemeClass =
globals.theme === 'light'
? 'LightLandingPageInnerWrapper'
: 'DarkLandingPageInnerWrapper';
const headerDescriptionClass =
globals.theme === 'light'
? 'lightHeaderDescription'
: 'darkHeaderDescription';
let inProgressHtml = (
<div className="descriptionText">
Logging out{' '}
<span>
<i className="fa fa-spinner fa-spin" />
</span>
</div>
);
if (!this.state.inProgress) {
inProgressHtml = (
<div className="descriptionText">{this.state.logoutMsg}</div>
);
}
return (
<div
className={
'displayFlex landingPageWrapper container-fluid ' +
pageWrapperThemeClass
}
>
<Helmet>
<meta charSet="utf-8" />
<title>Logout</title>
</Helmet>
<div className={'landingPageInnerWidth'}>
<div className={'landingPageInnerWrapper ' + pageInnerThemeClass}>
<div className="signUpWrapper">
<div className={headerDescriptionClass} />
<div className="descriptionText">{inProgressHtml}</div>
</div>
</div>
</div>
</div>
);
}
}
export default Logout;