#10 Add redirect to detail page after creating new bug
Lena
created
Change summary
webui/src/pages/new/NewBugPage.tsx | 6 ++++++
1 file changed, 6 insertions(+)
Detailed changes
@@ -1,4 +1,5 @@
import React, { FormEvent, useState } from 'react';
+import { useHistory } from 'react-router-dom';
import { Button } from '@material-ui/core';
import Paper from '@material-ui/core/Paper';
@@ -43,7 +44,9 @@ function NewBugPage() {
const [issueTitle, setIssueTitle] = useState('');
const [issueComment, setIssueComment] = useState('');
const classes = useStyles();
+
let issueTitleInput: any;
+ let history = useHistory();
function submitNewIssue(e: FormEvent) {
e.preventDefault();
@@ -55,6 +58,9 @@ function NewBugPage() {
message: issueComment,
},
},
+ }).then(function (data) {
+ const id = data.data?.newBug.bug.humanId;
+ history.push('/bug/' + id);
});
issueTitleInput.value = '';
}