move session init before main render

This commit is contained in:
Martti Malmi 2023-08-19 21:45:12 +03:00
parent 4ad1323ab8
commit aec5728669
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,6 @@ import Footer from './components/Footer';
import Show from './components/helpers/Show';
import Menu from './components/Menu';
import Modal from './components/modal/Modal';
import Session from './nostr/Session';
import { translationLoaded } from './translations/Translation.mjs';
import Helpers from './utils/Helpers';
import About from './views/About';
@ -44,8 +43,6 @@ type ReactState = {
showLoginModal: boolean;
};
Session.init({ autologin: false, autofollow: false });
class Main extends Component<Props, ReactState> {
componentDidMount() {
window.onload = () => {
@ -158,6 +155,4 @@ class Main extends Component<Props, ReactState> {
}
}
Helpers.showConsoleWarning();
export default Main;

View File

@ -13,6 +13,7 @@ import { Path } from './path';
import PubSub from './PubSub';
import Relays from './Relays';
import SocialNetwork from './SocialNetwork';
import Helpers from "@/utils/Helpers.tsx";
try {
localStorage.setItem('gunPeers', JSON.stringify({})); // quick fix to not connect gun
@ -148,6 +149,7 @@ const Session = {
init: function (options: any) {
Key.getOrCreate(options);
localState.get('loggedIn').on(() => this.onLoggedIn());
Helpers.showConsoleWarning();
},
};

View File

@ -1,7 +1,11 @@
import { render } from 'preact';
import Session from '@/nostr/Session';
import Main from './js/Main';
import './index.css';
Session.init({ autologin: false, autofollow: false });
render(<Main />, document.getElementById('app') as HTMLElement);