integraion with backend in progress
This commit is contained in:
@@ -11,6 +11,16 @@ import {
|
||||
} from 'semantic-ui-react';
|
||||
const { Box } = require('reflexbox');
|
||||
|
||||
const serialize = function(obj: any) {
|
||||
var str = [];
|
||||
for(var p in obj){
|
||||
if (obj.hasOwnProperty(p)) {
|
||||
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
|
||||
}
|
||||
}
|
||||
return str.join('&');
|
||||
};
|
||||
|
||||
export class LexEdit extends React.Component<any, any> {
|
||||
imageRoot = '/png/';
|
||||
constructor(props: any) {
|
||||
@@ -90,9 +100,21 @@ export class LexEdit extends React.Component<any, any> {
|
||||
let lexItem = this.props.lexItem;
|
||||
this.setState({ lexItem });
|
||||
}
|
||||
|
||||
private handleOnLoad(event: any) {
|
||||
// this.props.load(this.state.lexItem)
|
||||
console.log('loading from server');
|
||||
let lexItem = this.props.lexItem;
|
||||
let word = _.get<any>(lexItem, this.props.fieldMetaMap.label.lens, '');
|
||||
let pos = _.get<any>(lexItem, this.props.fieldMetaMap.pos.lens, '');
|
||||
let args = serialize({word,pos});
|
||||
fetch('/morph?'+args)
|
||||
.then((response) => response.text())
|
||||
.then((jsonMorph) => {
|
||||
console.log(jsonMorph);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log('errored :', e);
|
||||
});
|
||||
}
|
||||
|
||||
private handleOnChange(event: any) {
|
||||
|
||||
Reference in New Issue
Block a user