mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 12:03:00 +00:00
Add UI error dialogues to api requests
This commit is contained in:
@@ -28,7 +28,16 @@ const CreateGroup = (props) => {
|
||||
{errorAlert != null ? (
|
||||
<div className="row">
|
||||
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
||||
<div className="alert alert-danger">{errorAlert}</div>
|
||||
<div className="alert alert-danger">
|
||||
{errorAlert}
|
||||
<button
|
||||
type="button"
|
||||
className="close"
|
||||
onClick={() => setErrorAlert(null)}
|
||||
>
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -69,16 +78,18 @@ const CreateGroup = (props) => {
|
||||
? updateGroups(0, limit)
|
||||
.then((data) => dispatchPageUpdate(data, 0))
|
||||
.then(() => history.push("/groups"))
|
||||
.catch((err) => console.log(err))
|
||||
.catch((err) =>
|
||||
setErrorAlert(`Could not update groups list.`)
|
||||
)
|
||||
: setErrorAlert(
|
||||
`[${data.status}] Failed to create group. ${
|
||||
`Failed to create group. ${
|
||||
data.status == 409
|
||||
? "Group already exists."
|
||||
: ""
|
||||
}`
|
||||
);
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
.catch((err) => setErrorAlert(`Could not create group.`));
|
||||
}}
|
||||
>
|
||||
Create
|
||||
|
Reference in New Issue
Block a user