A
A
Arti-Jack2018-07-01 00:34:35
JavaScript
Arti-Jack, 2018-07-01 00:34:35

Problems with initialization of VK API in React application: what to do?

I have a React application with the VK API connected there. But I can’t understand one thing: everything seems to be initialized, but requests to the server do not work.
Moreover, when I look at the contents of the API in the console:
5b37f249558ef160295005.png
As you can see, headId is here null.
Actually, it shouldn't be the same. It should be like this:
5b37f48e40d6f003018057.png
How did I add the VK API to the project? In the main index.html (which is in the public folder) added the following:

<!DOCTYPE html>
<html lang="en">
  <head>
   ......
    <script src="https://vk.com/js/api/openapi.js?153"; type="text/javascript"></script> 
......

And it seems like the connection was successful - you can check it through the inspector: 5b37f70a45ec3585543579.png
But the requests do not work and the initialization of the VK API did not complete correctly, although the application was configured and uploaded to githubpages. But what I did wrong - no idea.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question