Refactoring

This commit is contained in:
2025-01-19 15:37:34 -06:00
parent 8c49360653
commit db4af1e3ed
2 changed files with 13 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAppContext } from '../../hooks/appContext/UseAppContext';
import {
Button,
MenuItem,
Navbar,
PlaneIcon,
@@ -19,7 +20,7 @@ const SiteNav: React.FC<unknown> = () => {
const [userPhoto, setUserPhoto] = useState<string>();
const httpClient: AxiosInstance = useHttpClient();
const appContext = useAppContext();
const isAuthenticated = useIsAuthenticated();
// const isAuthenticated = useIsAuthenticated();
// const { getAccessToken } = useAccessToken();
const { instance } = useMsal();
const navigate = useNavigate();
@@ -125,15 +126,16 @@ const SiteNav: React.FC<unknown> = () => {
// }, [isAuthenticated]);
return (
<Navbar
handlePageClick={handlePageClick}
handleSignIn={handleSignInRedirect}
isAuthenticated={isAuthenticated}
logo={<PlaneIcon size="2x" />}
pages={pages}
settings={<Settings />}
userPhoto={userPhoto}
/>
<Button onClick={handleSignInRedirect}>Sign In</Button>
// <Navbar
// handlePageClick={handlePageClick}
// handleSignIn={handleSignInRedirect}
// isAuthenticated={isAuthenticated}
// logo={<PlaneIcon size="2x" />}
// pages={pages}
// settings={<Settings />}
// userPhoto={userPhoto}
// />
);
};

View File

@@ -7,7 +7,7 @@ interface AuthProviderProps {
children: ReactNode
}
export const AuthProvider = async ({ children }: AuthProviderProps ) => {
export const AuthProvider = ({ children }: AuthProviderProps ) => {
const msalInstance = new PublicClientApplication(msalConfig);
// Default to using the first account if no account is active on page load
@@ -26,9 +26,6 @@ export const AuthProvider = async ({ children }: AuthProviderProps ) => {
}
});
await msalInstance.initialize();
// msalInstance.handleRedirectPromise();
return <MsalProvider instance={msalInstance}>
{children}
</MsalProvider>