Skip to content

Instantly share code, notes, and snippets.

@artemrogov
Created January 17, 2020 21:37
Show Gist options
  • Save artemrogov/bf8a8ec664c9e436d6333771f758e5f1 to your computer and use it in GitHub Desktop.
Save artemrogov/bf8a8ec664c9e436d6333771f758e5f1 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import WidgetStateOrg from './bundle.js';
import WidgetAuth from './widget_auth';
export default class Widget1604 extends Component {
constructor(props, context) {
super(props, context);
this.state = {
OGRN:"",
URL:"https://gisp.gov.ru/ns-1604/widgetstatOgrn",
tokenWidget:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBcHAgQXV0aCIsImlhdCI6MTU3NzM1MjIwMiwiZXhwIjoxNTc5OTQ0MjAyLCJzdWIiOiJ0ZXN0T3JnMUBnaXNwLmdvdi5ydSIsImRhdGEiOnsiZGlzcGxheW5hbWUiOiLQmNCy0LDQvSDQmNCy0LDQvdC-0LIiLCJvcmdPR1JOIjoiMTA1NTgwMDcwOTkxMCIsIm9yZ25hbWUiOiLQkNCeINCh0JzQlyIsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vanNvbiIsIkFjY2VwdCI6ImFwcGxpY2F0aW9uL2pzb24ifX19.G40qXeglsfaUcOwdmOxilfxMCFypz7gH7rffbaDS9c8",
},
this.widgetContainer = this.widgetContainer.bind(this);
}
widgetContainer(){
this.authWidget = WidgetAuth();
this.authWidget.setToken(this.state.tokenWidget);
this.authWidget.getInfo().then(function(responseInfo) {
this.setState({
OGRN:responseInfo.data.orgOGRN
});
this.widgetStatOrgObject = WidgetStateOrg.FormsOccupancyWidget("WidgetStateOrgInit",
this.state.OGRN,
this.state.URL);
});
}
componentDidMount() {
this.widgetContainer();
}
render() {
return (
<div id="WidgetStateOrgInit"/>
);
}
}
if (document.getElementById('widget1604')) {
ReactDOM.render(<Widget1604 />, document.getElementById('widget1604'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment