fix logout issues

This commit is contained in:
Roland Osborne 2022-04-26 23:48:56 -07:00
parent a5c1e6a05d
commit 764c777c0c
5 changed files with 11 additions and 6 deletions

View File

@ -4,7 +4,6 @@ export function useConversationContext() {
const [state, setState] = useState({}); const [state, setState] = useState({});
useEffect(() => { useEffect(() => {
console.log("CREATED CONVERSATION");
}, []); }, []);
const updateState = (value) => { const updateState = (value) => {

View File

@ -8,8 +8,8 @@ export function Home() {
const app = useContext(AppContext); const app = useContext(AppContext);
useEffect(() => { useEffect(() => {
if (app) { if (app?.state) {
if (app.state == null) { if (app.state.access == null) {
navigate('/login') navigate('/login')
} }
else if (app.state.access === 'user') { else if (app.state.access === 'user') {

View File

@ -34,6 +34,12 @@ export function useIdentity() {
} }
}; };
useEffect(() => {
if (app.state && app.state.access != 'user') {
navigate('/');
}
}, [app]);
useEffect(() => { useEffect(() => {
if (profile?.state?.profile) { if (profile?.state?.profile) {
let identity = profile.state.profile; let identity = profile.state.profile;

View File

@ -5,7 +5,7 @@ import ReactResizeDetector from 'react-resize-detector';
export function VirtualList({ id, items, itemRenderer }) { export function VirtualList({ id, items, itemRenderer }) {
const REDZONE = 256; // recenter on canvas if in canvas edge redzone const REDZONE = 256; // recenter on canvas if in canvas edge redzone
const HOLDZONE = 512; // drop slots outside of holdzone of view const HOLDZONE = 1024; // drop slots outside of holdzone of view
const OVERSCAN = 256; // add slots in overscan of view const OVERSCAN = 256; // add slots in overscan of view
const DEFAULT_ITEM_HEIGHT = 64; const DEFAULT_ITEM_HEIGHT = 64;
const DEFAULT_LIST_HEIGHT = 4096; const DEFAULT_LIST_HEIGHT = 4096;
@ -143,7 +143,7 @@ export function VirtualList({ id, items, itemRenderer }) {
addSlot(container.id, getSlot(container)) addSlot(container.id, getSlot(container))
anchorBottom.current = false; anchorBottom.current = false;
if (containers.current[0].top + containers.current[0].height + 2 * GUTTER < scrollTop.current) { if (containers.current[0].top + containers.current[0].height + 2 * GUTTER + HOLDZONE < scrollTop.current) {
removeSlot(containers.current[0].id); removeSlot(containers.current[0].id);
containers.current.shift(); containers.current.shift();
} }

View File

@ -172,7 +172,7 @@ export function useAppContext() {
if (state.access === 'admin') { if (state.access === 'admin') {
return { state, actions: adminActions } return { state, actions: adminActions }
} }
return { actions: accessActions } return { state, actions: accessActions }
} }