11import '../public/styles/style.css' ;
22
3- import React , { useEffect } from 'react' ;
3+ import React , { useEffect , useState } from 'react' ;
44import {
55 setInitialState ,
66 toggleLoggedIn
@@ -19,16 +19,20 @@ import { saveProject } from '../helperFunctions/projectGetSaveDel';
1919// Intermediary component to wrap main App component with higher order provider components
2020export const App = ( ) : JSX . Element => {
2121 const state = useSelector ( ( store : RootState ) => store . appState ) ;
22+ const [ toggleAttempt , setToggleAttempt ] = useState ( false ) ;
2223 const dispatch = useDispatch ( ) ;
2324 // checks if user is signed in as guest or actual user and changes loggedIn boolean accordingly
2425 useEffect ( ( ) => {
2526 if ( window . localStorage . getItem ( 'ssid' ) !== 'guest' ) {
26- dispatch ( toggleLoggedIn ( ) ) ;
27+ dispatch ( toggleLoggedIn ( true ) ) ;
2728 }
29+ //setToggleAttempt(!toggleAttempt);
2830 } , [ ] ) ;
2931
3032 // following useEffect runs on first mount
3133 useEffect ( ( ) => {
34+ console . log ( 'state.isLoggedIn' , state . isLoggedIn )
35+ // console.log('cookies.get in App', Cookies.get())
3236 // if user is a guest, see if a project exists in localforage and retrieve it
3337 if ( ! state . isLoggedIn ) {
3438 localforage . getItem ( 'guestProject' ) . then ( ( project ) => {
@@ -39,6 +43,7 @@ export const App = (): JSX.Element => {
3943 } ) ;
4044 } else {
4145 // otherwise if a user is logged in, use a fetch request to load user's projects from DB
46+
4247 let userId ;
4348 if ( Cookies . get ( 'ssid' ) ) {
4449 userId = Cookies . get ( 'ssid' ) ;
0 commit comments