some build cleanup

This commit is contained in:
Roland Osborne 2023-01-14 12:02:50 -08:00
parent 7145542874
commit d480bb754b
4 changed files with 14 additions and 18 deletions

View File

@ -34,12 +34,6 @@ export function useAdmin() {
check(); check();
}, []); }, []);
useEffect(() => {
if (app.state.adminToken) {
navigate('/dashboard');
}
}, [app.state]);
const actions = { const actions = {
setPassword: (password) => { setPassword: (password) => {
updateState({ password }); updateState({ password });

View File

@ -1,4 +1,4 @@
import { useContext, useRef, useState, useEffect } from 'react'; import { useContext, useState, useEffect } from 'react';
import { getNodeConfig } from 'api/getNodeConfig'; import { getNodeConfig } from 'api/getNodeConfig';
import { setNodeConfig } from 'api/setNodeConfig'; import { setNodeConfig } from 'api/setNodeConfig';
import { getNodeAccounts } from 'api/getNodeAccounts'; import { getNodeAccounts } from 'api/getNodeAccounts';
@ -42,6 +42,7 @@ export function useDashboard() {
syncConfig(); syncConfig();
syncAccounts(); syncAccounts();
} }
// eslint-disable-next-line
}, [app]); }, [app]);
const actions = { const actions = {

View File

@ -1,8 +1,5 @@
import { useEffect, useContext } from 'react';
import { Drawer, Spin } from 'antd'; import { Drawer, Spin } from 'antd';
import { useNavigate } from 'react-router-dom';
import { SessionWrapper } from './Session.styled'; import { SessionWrapper } from './Session.styled';
import { AppContext } from 'context/AppContext';
import { useSession } from './useSession.hook'; import { useSession } from './useSession.hook';
import { Conversation } from './conversation/Conversation'; import { Conversation } from './conversation/Conversation';
import { Details } from './details/Details'; import { Details } from './details/Details';
@ -19,14 +16,6 @@ import { BottomNav } from './bottomNav/BottomNav';
export function Session() { export function Session() {
const { state, actions } = useSession(); const { state, actions } = useSession();
const app = useContext(AppContext);
const navigate = useNavigate();
useEffect(() => {
if (!app.state.status) {
navigate('/');
}
}, [app, navigate]);
const closeAccount = () => { const closeAccount = () => {
actions.closeProfile(); actions.closeProfile();

View File

@ -1,4 +1,6 @@
import { useContext, useState, useEffect, useRef } from 'react'; import { useContext, useState, useEffect, useRef } from 'react';
import { useNavigate } from 'react-router-dom';
import { AppContext } from 'context/AppContext';
import { CardContext } from 'context/CardContext'; import { CardContext } from 'context/CardContext';
import { StoreContext } from 'context/StoreContext'; import { StoreContext } from 'context/StoreContext';
import { ViewportContext } from 'context/ViewportContext'; import { ViewportContext } from 'context/ViewportContext';
@ -23,12 +25,15 @@ export function useSession() {
loading: false, loading: false,
}); });
const app = useContext(AppContext);
const card = useContext(CardContext); const card = useContext(CardContext);
const store = useContext(StoreContext); const store = useContext(StoreContext);
const viewport = useContext(ViewportContext); const viewport = useContext(ViewportContext);
const channel = useContext(ChannelContext); const channel = useContext(ChannelContext);
const profile = useContext(ProfileContext); const profile = useContext(ProfileContext);
const navigate = useNavigate();
const storeStatus = useRef(null); const storeStatus = useRef(null);
const cardStatus = useRef(0); const cardStatus = useRef(0);
@ -45,6 +50,13 @@ export function useSession() {
} }
}, [card, channel, profile]); }, [card, channel, profile]);
useEffect(() => {
if (!app.state.status) {
navigate('/');
}
// eslint-disable-next-line
}, [app.state]);
useEffect(() => { useEffect(() => {
updateState({ display: viewport.state.display }); updateState({ display: viewport.state.display });
}, [viewport]); }, [viewport]);