change : send message

This commit is contained in:
snoop 2017-06-06 17:09:11 +09:00
parent 35852f03a0
commit 5ed0907451
4 changed files with 45 additions and 21 deletions

View File

@ -29,6 +29,7 @@ export class App extends React.Component<any, any> {
super(props, context); super(props, context);
} }
render() { render() {
return ( return (
<MuiThemeProvider muiTheme={muiTheme}> <MuiThemeProvider muiTheme={muiTheme}>

View File

@ -21,13 +21,19 @@ export class OFRest {
} }
public Call() { public Call() {
let m :any;
m = {
"model" : this.obj
}
return fetch(url, { return fetch(url, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
// mode: 'no-cors' // mode: 'no-cors'
}, },
body: JSON.stringify(this.obj) body: JSON.stringify(m)
}) })
} }

View File

@ -70,6 +70,7 @@ export class Regist extends React.Component<any, any> {
handleSignUp = () => { handleSignUp = () => {
let output: string; let output: string;
let obj: any; //new object declaration let obj: any; //new object declaration
obj = { obj = {

View File

@ -7,6 +7,8 @@ import Paper from 'material-ui/Paper';
import { OFRest } from '../../components/Rest'; import { OFRest } from '../../components/Rest';
import * as Utils from '../../components/Utils'; import * as Utils from '../../components/Utils';
import RaisedButton from 'material-ui/RaisedButton';
const styles = { const styles = {
test: { test: {
display: 'inline-block', display: 'inline-block',
@ -51,7 +53,7 @@ function wrapState(ComposedComponent: any, par: any) {
}; };
} }
var testRes = "[{\"id\":1,\"ip\":3232235882,\"port\":5432,\"targetType\":\"DATABASE\",\"vendorName\":\"PostgreSQL 9.5.0\",\"kinds\":\"PostgreSQL\",\"version\":\"9.5.0\",\"createDate\":1496631864025,\"member\":{\"id\":1,\"email\":\"insanity33@loafle.com\",\"pwSalt\":\"salktttt\",\"digest\":\"bbbbbbbbb\",\"name\":\"insanity3\",\"company\":\"loafle\",\"phone\":\"000-000-0000\",\"authorizedDate\":null}},{\"id\":2,\"ip\":3232235882,\"port\":5432,\"targetType\":\"DATABASE\",\"vendorName\":\"PostgreSQL 9.5.0\",\"kinds\":\"PostgreSQL\",\"version\":\"9.5.0\",\"createDate\":1496635285090,\"member\":{\"id\":1,\"email\":\"insanity33@loafle.com\",\"pwSalt\":\"salktttt\",\"digest\":\"bbbbbbbbb\",\"name\":\"insanity3\",\"company\":\"loafle\",\"phone\":\"000-000-0000\",\"authorizedDate\":null}},{\"id\":3,\"ip\":3232235882,\"port\":5432,\"targetType\":\"DATABASE\",\"vendorName\":\"PostgreSQL 9.5.0\",\"kinds\":\"PostgreSQL\",\"version\":\"9.5.0\",\"createDate\":-62135596800000,\"member\":{\"id\":1,\"email\":\"\",\"pwSalt\":\"\",\"digest\":\"\",\"name\":\"\",\"company\":\"\",\"phone\":\"\",\"authorizedDate\":0}}]"; var testRes = "[{\"id\":1,\"ip\":3232235882,\"port\":5432,\"targetType\":\"DATABASE\",\"vendorName\":\"PostgreSQL 9.5.0\",\"kinds\":\"PostgreSQL\",\"version\":\"9.5.0\",\"createDate\":1496631864025,\"member\":{\"id\":1,\"email\":\"insanity33@loafle.com\",\"pwSalt\":\"salktttt\",\"digest\":\"bbbbbbbbb\",\"name\":\"insanity3\",\"company\":\"loafle\",\"phone\":\"000-000-0000\",\"authorizedDate\":null}}]";
var RES = JSON.parse(testRes); var RES = JSON.parse(testRes);
@ -62,35 +64,49 @@ export class TargetList extends React.Component<any, any> {
this.componentWillMount = this.componentWillMount.bind(this) this.componentWillMount = this.componentWillMount.bind(this)
this.getTargetList = this.getTargetList.bind(this);
} }
componentWillMount() { componentWillMount() {
this.getTargetList();
} }
getTargetList() { getTargetList() {
let obj: any
obj = {
"id":"0",
"member":{
"id":"1"
}
};
// let os: OFRest = new OFRest("Member", "Regist", obj); let os: OFRest = new OFRest("Target", "List", obj);
// os.Call().then(function (res) { os.Call().then(function (res) {
// return res.json(); return res.json();
// }).then(function (json) { }).then(function (json) {
// console.log(json);
// }).catch(function (err) {
// console.log(err);
// });
RES = JSON.parse(json)
}).catch(function (err) {
console.log(err);
});
} }
handleSelect(idx: any) { handleSelect(idx: any) {
this.props.onChange(idx); this.props.onChange(idx);
} }
handleSignUp() {
this.getTargetList()
}
render() { render() {
let num :number; let num: number;
num = 1; num = 1;
return ( return (
<div style={styles.container}> <div style={styles.container}>
@ -107,7 +123,7 @@ export class TargetList extends React.Component<any, any> {
RES.map(function (item: any, index: number) { RES.map(function (item: any, index: number) {
let port :string; let port: string;
port = "Port : " port = "Port : "
@ -130,7 +146,7 @@ export class TargetList extends React.Component<any, any> {
]} ]}
/> />
</SelectableList> </SelectableList>
<RaisedButton label="Sign Up" primary={true} onClick={this.handleSignUp.bind(this)} />
</div> </div>
); );