popup info ; token update

This commit is contained in:
GotPPay
2018-01-05 17:56:24 +01:00
parent b55dd56859
commit 03c346f5d2
4 changed files with 35 additions and 10 deletions

View File

@@ -3,9 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"keymaster": "^1.6.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-md": "^1.2.8",
"react-popup": "^0.9.1",
"react-scripts": "1.0.17",
"webfontloader": "^1.6.28"
},

View File

@@ -1,8 +1,10 @@
import React, { Component } from 'react';
import './css/App.css';
import './css/popup.css';
import IntentList from './components/IntentList';
import IntentDetails from './components/IntentDetails';
import LaunchRequest from './components/LaunchRequest';
import Popup from 'react-popup';
import {getSkill, updateSkill} from './lib/api'
@@ -42,6 +44,7 @@ class App extends Component {
if(this.state.launchRequest){
return (
<div className="App">
<Popup/>
<div className="App-header">
<h1> Tell All </h1>
</div>
@@ -59,6 +62,7 @@ class App extends Component {
}else{
return (
<div className="App">
<Popup/>
<div className="App-header">
<h1> Tell All </h1>
</div>
@@ -100,10 +104,15 @@ class App extends Component {
console.log("handleSaveLaunchRequest");
updateSkill(this.createSkill(this.state.allIntents,name,answer)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
console.log(jResult.result);
if (jResult.result !== 0){
Popup.alert('Model was not saved. Please try again');
}else{
Popup.alert('Saved');
}
console.log(jResult.message);
}).catch(e=>{
console.log("Error :" + e);
Popup.alert('Model was not saved. Please try again');
});
}
@@ -118,10 +127,15 @@ class App extends Component {
this.setState({allIntents: newAllIntents, selectedIntent: {intentName:'', questions:[''],answer:''}});
updateSkill(this.createSkill(newAllIntents)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
console.log(jResult.result);
if (jResult.result !== 0){
Popup.alert('Model was not saved. Please try again');
}else{
Popup.alert('Saved');
}
console.log(jResult.message);
}).catch(e=>{
console.log("error : " + e);
Popup.alert('Model was not saved. Please try again');
});
}catch(e){
console.log("error : " + e);
@@ -143,9 +157,14 @@ class App extends Component {
updateSkill(this.createSkill(newAllIntents)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
console.log(jResult.result);
if (jResult.result !== 0){
Popup.alert('Model was not saved. Please try again');
}else{
Popup.alert('Saved');
}
console.log(jResult.message);
}).catch(e=>{
Popup.alert('Model was not saved. Please try again');
console.log("error : " + e);
});