diff --git a/client/src/App.tsx b/client/src/App.tsx
index 3b3321b7..7a951869 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -27,7 +27,7 @@ import './styles/custom.scss';
* @returns {React.ReactNode} The rendered component.
*/
function App(): React.ReactNode {
- const { signed, checkCurrentAuthUser } = useContext(AuthContext);
+ const { signed, loading } = useContext(AuthContext);
const [theme, setTheme] = useState(() => {
return localStorage.getItem('theme') ?? 'light';
});
@@ -114,10 +114,6 @@ function App(): React.ReactNode {
const browserRouter = getBrowserRouter();
- useEffect(() => {
- checkCurrentAuthUser(window.location.pathname);
- }, []);
-
useEffect(() => {
document.body.setAttribute('data-bs-theme', theme);
localStorage.setItem('theme', theme);
@@ -138,7 +134,7 @@ function App(): React.ReactNode {
{/* Your routes or content here */}
-
+ {!loading && }
>
);
};
diff --git a/client/src/__test__/__mocks__/authContextMock.ts b/client/src/__test__/__mocks__/authContextMock.ts
index 4b9b12dc..a13fc205 100644
--- a/client/src/__test__/__mocks__/authContextMock.ts
+++ b/client/src/__test__/__mocks__/authContextMock.ts
@@ -2,6 +2,7 @@ import { vi } from "vitest";
const authContextMock = {
signed: true,
+ loading: false,
user: undefined,
checkCurrentAuthUser: vi.fn(),
signIn: vi.fn(),
diff --git a/client/src/__test__/context/AuthProvider.test.tsx b/client/src/__test__/context/AuthProvider.test.tsx
index b8fb5b9a..7487b5fc 100644
--- a/client/src/__test__/context/AuthProvider.test.tsx
+++ b/client/src/__test__/context/AuthProvider.test.tsx
@@ -15,6 +15,7 @@ vi.mock('../../api-service/api');
const ConsumerComponent: React.FC = () => {
const {
signed,
+ loading,
user,
signIn,
register,
@@ -26,6 +27,7 @@ const ConsumerComponent: React.FC = () => {
return (
{signed ? 'true' : 'false'}
+
{loading ? 'true' : 'false'}
{user ? user.name : 'none'}