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();
}, []);
useEffect(() => {
if (app.state.adminToken) {
navigate('/dashboard');
}
}, [app.state]);
const actions = {
setPassword: (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 { setNodeConfig } from 'api/setNodeConfig';
import { getNodeAccounts } from 'api/getNodeAccounts';
@ -42,6 +42,7 @@ export function useDashboard() {
syncConfig();
syncAccounts();
}
// eslint-disable-next-line
}, [app]);
const actions = {

View File

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

View File

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