added Rest

This commit is contained in:
snoop 2017-06-04 19:25:16 +09:00
parent bcad64f29d
commit 8eb9d20701

View File

@ -13,6 +13,7 @@ import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import Slider from 'material-ui/Slider';
import { OFRest } from '../../components/Rest';
const styles = {
body: {
@ -79,84 +80,22 @@ export class Regist extends React.Component<any, any> {
"phone": this.state.phone
};
let os: OFRest = new OFRest("Member", "Regist", obj);
os.Call().then(function (res) {
return res.json();
}).then(function (json) {
console.log(json);
}).catch(function (err) {
console.log(err);
});
}
public validateEmail(email: any) {
return EMailRegex.test(email);
}
handleTestRead = () => {
let output: string;
let obj: any; //new object declaration
obj = {
"id": this.state.id,
"email": this.state.email,
"pwSalt": this.state.pw,
"name": this.state.name,
"company": this.state.company,
"phone": this.state.phone
};
let exeObj: any;
exeObj = {
"serviceName": "Member",
"methodName": "Read",
"param": obj
};
output = JSON.stringify(exeObj);
}
handleTestUpdate = () => {
let output: string;
let obj: any; //new object declaration
obj = {
"id": this.state.id,
"email": this.state.email,
"pwSalt": this.state.pw,
"name": this.state.name,
"company": this.state.company,
"phone": this.state.phone
};
let exeObj: any;
exeObj = {
"serviceName": "Member",
"methodName": "Modify",
"param": obj
};
output = JSON.stringify(exeObj);
}
handleTestDelete = () => {
let output: string;
let obj: any; //new object declaration
obj = {
"id": this.state.id,
"email": this.state.email,
"pwSalt": this.state.pw,
"name": this.state.name,
"company": this.state.company,
"phone": this.state.phone
};
let exeObj: any;
exeObj = {
"serviceName": "Member",
"methodName": "Remove",
"param": obj
};
output = JSON.stringify(exeObj);
}
handleResultContainer = () => {
}
@ -233,19 +172,6 @@ export class Regist extends React.Component<any, any> {
<br />
<RaisedButton label="Sign Up" primary={true} style={styles.button} onClick={this.handleSignUp.bind(this)} />
<RaisedButton label="Read" primary={true} style={styles.button} onClick={this.handleTestRead.bind(this)} />
<RaisedButton label="Update" primary={true} style={styles.button} onClick={this.handleTestUpdate.bind(this)} />
<RaisedButton label="Delete" primary={true} style={styles.button} onClick={this.handleTestDelete.bind(this)} />
<br />
<TextField
hintText="id"
floatingLabelText="id"
style={styles.textfield}
value={this.state.id}
onChange={(e, newValue) => this.setState({ id: newValue })}
/>
</div>
);
}