Commit 274a44c9 authored by Devinda's avatar Devinda

fix automatic_question

parent 7302e815
......@@ -48,7 +48,7 @@ export default class Automatic_question extends Component {
}
onSubmit(e){
async onSubmit(e) {
e.preventDefault();
//if(this.state.item_name != null && this.state.item_description != null && this.state.item_category != null && this.state.item_quantity != null && this.state.item_price){
......@@ -59,19 +59,30 @@ export default class Automatic_question extends Component {
console.log(`Genaral Feedback: ${this.state.general_feedback}`);
const newQuestion = {
lesson_no : this.state.lesson_no,
lesson_name : this.state.lesson_name,
defult_mark : this.state.defult_mark,
general_feedback : this.state.general_feedback,
lesson_no: this.state.lesson_no,
lesson_name: this.state.lesson_name,
defult_mark: this.state.defult_mark,
general_feedback: this.state.general_feedback,
};
axios.post('http://127.0.0.1:5000/generate')
.then(res => {this.setState({
question_id: res.data.question_id})
})
.catch(//swal("Good job!", "You clicked the button!", "warning"
);
swal("Data Saved Successfully!", "Your Details has been Saved Successfully!", "success");
let options = {
uri: 'http://127.0.0.1:5000/generate',
body: JSON.stringify(newQuestion),
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
}
let response = await axios.post(options.uri, options.body);
console.log(response.data.result);
// axios.post('http://127.0.0.1:5000/generate')
// .then(res => {this.setState({
// question_id: res.data.question_id})
// })
// .catch(//swal("Good job!", "You clicked the button!", "warning"
// );
// swal("Data Saved Successfully!", "Your Details has been Saved Successfully!", "success");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment