graasp / graasp/client

Display error message when CurrentMember request fails on network error

Open
#512 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

```tsx
import { Refresh } from '@mui/icons-material';
import {
Alert,
AlertTitle,
IconButton,
Stack,
Tooltip,
Typography,
} from '@mui/material';
import { Box } from '@mui/material';

import { FAILURE_MESSAGES } from '@graasp/translations';

import { useMessagesTranslation, usePlayerTranslation } from '@/config/i18n';

const NetworkErrorAlert = () => {
const { t: messagesTranslations } = useMessagesTranslation();
const { t } = usePlayerTranslation();
return (



{messagesTranslations(FAILURE_MESSAGES.UNEXPECTED_ERROR)}



{t(
'There seems to be a problem joining the server. Please try again later',
)}



window.location.reload()}>







);
};
export default NetworkErrorAlert;
```

And in `App.tsx`
```tsx
if (
isError &&
(currentMemberError as { code: string }).code === 'ERR_NETWORK'
) {
return ;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.