Skip to content

Commit

Permalink
Added increased error reporting to register page
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-dalby committed Nov 24, 2024
1 parent 83d6ed4 commit ccfb5c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/src/components/auth/RegisterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AlertCircle } from 'lucide-react';
import { ROUTES } from '../../constants/routes';
import { OIDCConfig } from '../../types/auth';
import { apiClient } from '../../utils/api/apiClient';
import { handleOIDCError } from '../../utils/oidcErrorHandler';

export const RegisterPage: React.FC = () => {
const [username, setUsername] = useState('');
Expand All @@ -31,6 +32,16 @@ export const RegisterPage: React.FC = () => {
fetchOIDCConfig();
}, []);

useEffect(() => {
const params = new URLSearchParams(window.location.search);
const error = params.get('error');
const message = params.get('message');

if (error) {
handleOIDCError(error, addToast, oidcConfig?.displayName, message || undefined);
}
}, [addToast, oidcConfig]);

if (isAuthenticated) {
return <Navigate to="/" replace />;
}
Expand Down

0 comments on commit ccfb5c6

Please sign in to comment.