Fixed auth not remembering user is logged in.
This commit is contained in:
parent
48631c98c3
commit
caa67cd111
@ -83,6 +83,11 @@ const AuthProvider = ({ children }) => {
|
||||
// Read token from cookies if present
|
||||
useEffect(() => {
|
||||
try {
|
||||
console.log(
|
||||
'Retreiving token from cookies...',
|
||||
getAuthCookies(),
|
||||
validateAuthCookies()
|
||||
)
|
||||
// First validate existing cookies to clean up expired ones
|
||||
if (validateAuthCookies()) {
|
||||
const {
|
||||
@ -210,7 +215,11 @@ const AuthProvider = ({ children }) => {
|
||||
setUserProfile(authData)
|
||||
|
||||
// Store in cookies for persistence between tabs
|
||||
const cookieSuccess = setAuthCookies(authData)
|
||||
const cookieSuccess = setAuthCookies({
|
||||
user: authData,
|
||||
access_token: authData.access_token,
|
||||
expires_at: authData.expires_at
|
||||
})
|
||||
if (!cookieSuccess) {
|
||||
messageApi.warning(
|
||||
'Authentication successful but failed to save login state. You may need to log in again if you close this tab.'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user