Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ export const useFrappeAuth = (options?: SWRConfiguration): {
const login = useCallback(async (credentials:AuthCredentials) => {
return auth.loginWithUsernamePassword(credentials)
.then((m) => {
getUserCookie()
// THE FIX IS HERE:
// Manually trigger a re-fetch of the user data after login.
updateCurrentUser();
return m
})
}, [])
}, [updateCurrentUser]) // ✅And the dependency is added here

const logout = useCallback(async () => {
return auth.logout()
Expand Down