Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error for EditProfileDialog #423

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/ProfilePage/EditProfileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogActions from '@material-ui/core/DialogActions';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Snackbar from '@material-ui/core/Snackbar';

const EditProfileDialogUserData = gql`
fragment EditProfileDialogUserData on User {
Expand All @@ -33,8 +34,12 @@ function EditProfileDialog({ user, onClose = () => {} }) {
onCompleted() {
onClose();
},
onError(error) {
setSnackMsg(t`Changes cannot be saved: ${error}`);
},
});
const [slug, setSlug] = useState(user.slug);
const [snackMsg, setSnackMsg] = useState('');

const handleSubmit = e => {
e.preventDefault();
Expand Down Expand Up @@ -93,6 +98,11 @@ function EditProfileDialog({ user, onClose = () => {} }) {
>{t`Submit`}</Button>
</DialogActions>
</form>
<Snackbar
open={!!snackMsg}
onClose={() => setSnackMsg('')}
message={snackMsg}
/>
</Dialog>
);
}
Expand Down