hyperspace-desktop-client-w.../src/index.tsx

41 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-03-25 20:53:33 +01:00
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
2019-03-25 22:01:39 +01:00
import { HashRouter } from 'react-router-dom';
2019-03-25 20:53:33 +01:00
import * as serviceWorker from './serviceWorker';
2019-04-08 00:31:18 +02:00
import {createUserDefaults, getConfig} from './utilities/settings';
2019-04-05 22:29:11 +02:00
import {collectEmojisFromServer} from './utilities/emojis';
2019-03-30 22:13:49 +01:00
import {SnackbarProvider} from 'notistack';
2019-04-07 23:25:39 +02:00
import { userLoggedIn, refreshUserAccountData } from './utilities/accounts';
2019-04-08 00:31:18 +02:00
getConfig().then((config: any) => {
document.title = config.branding.name || "Hyperspace";
2019-04-07 23:25:39 +02:00
}).catch((err: Error) => {
console.error(err);
})
createUserDefaults();
2019-04-07 23:25:39 +02:00
if (userLoggedIn()) {
collectEmojisFromServer();
refreshUserAccountData();
}
2019-03-25 20:53:33 +01:00
2019-03-25 22:01:39 +01:00
ReactDOM.render(
<HashRouter>
2019-03-30 22:13:49 +01:00
<SnackbarProvider
anchorOrigin={{
vertical: 'bottom',
2019-04-04 02:01:54 +02:00
horizontal: 'left',
2019-03-30 22:13:49 +01:00
}}
>
<App />
</SnackbarProvider>
2019-03-25 22:01:39 +01:00
</HashRouter>,
document.getElementById('root'));
2019-03-25 20:53:33 +01:00
2019-03-30 22:13:49 +01:00
2019-03-25 20:53:33 +01:00
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();