Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/components/AuthContext.jsx
Browse files
frontend/src/components/AuthContext.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
const AuthContext = createContext(null);
|
| 4 |
|
|
@@ -138,7 +139,7 @@ export const AuthProvider = ({ children }) => {
|
|
| 138 |
setUser(null);
|
| 139 |
setLoading(false);
|
| 140 |
}
|
| 141 |
-
}, [token]); // intentionally only re-run when token changes
|
| 142 |
|
| 143 |
// ββ Login β called after successful credentials check βββββββββββββββββββββ
|
| 144 |
const login = useCallback((newToken, newRefreshToken, userData) => {
|
|
|
|
| 1 |
+
/* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect, react-hooks/immutability, react-refresh/only-export-components */
|
| 2 |
+
import { createContext, useContext, useState, useEffect, useRef, useCallback } from 'react';
|
| 3 |
|
| 4 |
const AuthContext = createContext(null);
|
| 5 |
|
|
|
|
| 139 |
setUser(null);
|
| 140 |
setLoading(false);
|
| 141 |
}
|
| 142 |
+
}, [token]); // intentionally only re-run when token changes β fetchProfile excluded to avoid infinite loop
|
| 143 |
|
| 144 |
// ββ Login β called after successful credentials check βββββββββββββββββββββ
|
| 145 |
const login = useCallback((newToken, newRefreshToken, userData) => {
|