This commit is contained in:
wayanrivan
2025-05-20 14:29:49 +07:00
parent f162db0f15
commit f2319116b9
2 changed files with 150 additions and 2 deletions

View File

@ -63,7 +63,7 @@ const AuthProvider = ({ children }: PropsWithChildren) => {
id: auth.user.id,
role_name: auth.role_name,
user: auth.user,
statusbalance: auth.role.status_balance
statusbalance: auth.role?.status_balance ?? null // SAFE ACCESS
};
saveAuth(enhancedAuth);
@ -76,6 +76,7 @@ const AuthProvider = ({ children }: PropsWithChildren) => {
};
doSaveLogActivity(createActivity);
} catch (error: any) {
console.error('Login error:', error);
throw error;
}
};
@ -160,4 +161,4 @@ const AuthProvider = ({ children }: PropsWithChildren) => {
);
};
export { AuthContext, AuthProvider };
export { AuthContext, AuthProvider };