Compare commits

...

1 Commits

Author SHA1 Message Date
Francisco Sales
cb25ad8457 fix: length of undefined on users warnings 2024-07-14 13:50:57 +01:00

View File

@@ -17,14 +17,13 @@ interface UserWarningsProps {
const UserWarnings: React.FC<UserWarningsProps> = ({ onClick }) => {
const intl = useIntl();
const { user } = useUser();
if (!user) {
//check if a user has warnings
if (!user || !user.warnings || user.warnings.length === 0) {
return null;
}
let res = null;
//check if a user has warnings
if (user.warnings.length > 0) {
user.warnings.forEach((warning) => {
let link = '';
let warningText = '';
@@ -57,7 +56,6 @@ const UserWarnings: React.FC<UserWarningsProps> = ({ onClick }) => {
</Link>
);
});
}
return res;
};