Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class App extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- activePanel: 'home',
- fetchedUser: null,
- token: null,
- video: null,
- grid: null,
- friends: null,
- };
- }
- componentDidMount() {
- connect.subscribe((e) => {
- switch (e.detail.type) {
- case 'VKWebAppAccessTokenReceived':
- this.setState({token :e.detail.data.access_token });
- connect.send("VKWebAppCallAPIMethod", {"method": "friends.get", "request_id": "32test", "params": {"fields": fields, "v":"5.101", "access_token": this.state.token}});
- break;
- case 'VKWebAppCallAPIMethodResult':
- this.setState({friends: e.detail.data.response.items})
- break;
- default:
- //что-то дефолтное
- }
- });
- connect.send("VKWebAppGetAuthToken", {"app_id": 7115545, "scope": "friends,status,video"});
- connect.send('VKWebAppGetUserInfo', {});
- }
- go = (e) => {
- this.setState({ activePanel: e.currentTarget.dataset.to })
- };
- render() {
- return (
- <View >
- {this.state.friends !== null ? <div> {this.state.friends.map(el => <div> {el.photo_100} {el.bdate}</div>)}</div> : <div>nothing</div>}
- </View>
- );
- }
- }
- export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement