Skip to content

Commit

Permalink
fix: add token existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
mpblocky committed Feb 27, 2025
1 parent fa8dcaa commit 3053825
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ export function useEmailVerificationToken() {

return {
token,
isLoading: token === undefined,
};
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { PageCardLoader } from '@/shared/components/ui/page-card';
import { useTranslation } from 'react-i18next';
import { PageCardError } from '@/shared/components/ui/page-card';
import { EmailVerificationProcess } from '../components';
import { useEmailVerificationToken } from '../hooks';

export function WorkerEmailVerificationProcessPage() {
const { token, isLoading } = useEmailVerificationToken();
const { t } = useTranslation();
const { token } = useEmailVerificationToken();

if (isLoading || !token) {
return <PageCardLoader />;
if (!token) {
return (
<PageCardError
errorMessage={t('worker.emailVerification.errors.noToken')}
/>
);
}

return <EmailVerificationProcess token={token} />;
Expand Down
5 changes: 4 additions & 1 deletion packages/apps/human-app/frontend/src/shared/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@
"emailVerification": {
"title": "Email Verified",
"description": "You are ready to go. Your email has been successfully verified!",
"btn": "Sign In"
"btn": "Sign In",
"errors": {
"noToken": "No token provided."
}
},
"sendResetLinkForm": {
"fields": {
Expand Down

0 comments on commit 3053825

Please sign in to comment.