summaryrefslogtreecommitdiffstats
path: root/web/react/pages/login.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-21 14:36:46 -0600
committerCorey Hulen <corey@hulen.com>2016-01-21 14:36:46 -0600
commit6c86bae5d54a2f24733512e6c9eee78a832a45e3 (patch)
tree4e1db4ba11bc8dff70a8049ab887588686fa4d47 /web/react/pages/login.jsx
parenta2fa683c1b5fc0c62506e3ac40784b053eda6e3e (diff)
parent3ff05780a1b4f08d256a983bc9ec06f9841f0538 (diff)
downloadchat-6c86bae5d54a2f24733512e6c9eee78a832a45e3.tar.gz
chat-6c86bae5d54a2f24733512e6c9eee78a832a45e3.tar.bz2
chat-6c86bae5d54a2f24733512e6c9eee78a832a45e3.zip
Merge pull request #1949 from mattermost/PLT-7-client-infra
PLT-7 client infra
Diffstat (limited to 'web/react/pages/login.jsx')
-rw-r--r--web/react/pages/login.jsx69
1 files changed, 60 insertions, 9 deletions
diff --git a/web/react/pages/login.jsx b/web/react/pages/login.jsx
index 4a565623e..e0957a65b 100644
--- a/web/react/pages/login.jsx
+++ b/web/react/pages/login.jsx
@@ -1,17 +1,68 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
+import * as Client from '../utils/client.jsx';
import Login from '../components/login.jsx';
-function setupLoginPage(props) {
+var IntlProvider = ReactIntl.IntlProvider;
+ReactIntl.addLocaleData(ReactIntlLocaleData.en);
+ReactIntl.addLocaleData(ReactIntlLocaleData.es);
+
+class Root extends React.Component {
+ constructor() {
+ super();
+ this.state = {
+ translations: null,
+ loaded: false
+ };
+ }
+
+ static propTypes() {
+ return {
+ map: React.PropTypes.object.isRequired
+ };
+ }
+
+ componentWillMount() {
+ Client.getTranslations(
+ this.props.map.Locale,
+ (data) => {
+ this.setState({
+ translations: data,
+ loaded: true
+ });
+ },
+ () => {
+ this.setState({
+ loaded: true
+ });
+ }
+ );
+ }
+
+ render() {
+ if (!this.state.loaded) {
+ return <div></div>;
+ }
+
+ return (
+ <IntlProvider
+ locale={this.props.map.Locale}
+ messages={this.state.translations}
+ >
+ <Login
+ teamDisplayName={this.props.map.TeamDisplayName}
+ teamName={this.props.map.TeamName}
+ inviteId={this.props.map.InviteId}
+ />
+ </IntlProvider>
+ );
+ }
+}
+
+global.window.setup_login_page = function setup(props) {
ReactDOM.render(
- <Login
- teamDisplayName={props.TeamDisplayName}
- teamName={props.TeamName}
- inviteId={props.InviteId}
- />,
+ <Root map={props} />,
document.getElementById('login')
);
-}
-
-global.window.setup_login_page = setupLoginPage;
+}; \ No newline at end of file