Skip to content

Commit

Permalink
Add toast alert for error
Browse files Browse the repository at this point in the history
  • Loading branch information
whooaami committed Oct 28, 2023
1 parent 2538568 commit fe1beef
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
21 changes: 21 additions & 0 deletions FrontEnd/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions FrontEnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"react-router-dom": "^6.4.1",
"react-router-hash-link": "^2.4.3",
"react-scripts": "5.0.1",
"react-toastify": "^9.1.3",
"swr": "^2.2.2",
"validator": "^13.11.0",
"web-vitals": "^2.1.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { useNavigate } from 'react-router-dom';

import { toast, ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import axios from 'axios';
import styles from './ResendActivationFormContent.module.css';

Expand Down Expand Up @@ -44,7 +45,9 @@ export function ResendActivationFormContentComponent({ setIsValid }) {
setIsValid(true);
navigate('/login');
})
.catch((error) => console.log(error));
.catch(() => {
toast.error('Activation failed. Please try again.');
});
};

return (
Expand Down Expand Up @@ -88,6 +91,11 @@ export function ResendActivationFormContentComponent({ setIsValid }) {
</div>
</div>
</form>
<ToastContainer position="top-right" autoClose={3000} />
</div>
);
}

ResendActivationFormContentComponent.propTypes = {
setIsValid: PropTypes.func.isRequired,

Check failure on line 100 in FrontEnd/src/components/SignUp/components/signup/signup-form/ResendActivationFormContent.js

View workflow job for this annotation

GitHub Actions / Linting

'PropTypes' is not defined
};

0 comments on commit fe1beef

Please sign in to comment.