fix: updated the authentication system to handle edge cases better
this commit fixes several issues with the authentication system. first, we now properly handle the case where a user's session expires while they're in the middle of a form submission. second, we've added better error messages when authentication fails due to network issues. third, the token refresh logic has been improved to avoid race conditions.
additionally, this change includes some refactoring of the auth module to make it more maintainable. we've extracted the token validation logic into a separate function and added comprehensive unit tests.
closes #123, #456
breaking change: the AuthProvider component now requires a new onSessionExpire prop