При npm run deploy возникает ошибка:
Failed to compile.
./src/App.js
Line 46:3: Parsing error: Unexpected token
44 | <script>
45 | window.addEventListener('load', function() {
> 46 | var user_id = returnStr; // user's id
| ^
47 | var app_id = 7921483; // your app's id
48 |
49 | admanInit({
Сам App.js:
import React, { useState, useEffect } from 'react';
import bridge from '@vkontakte/vk-bridge';
import View from '@vkontakte/vkui/dist/components/View/View';
import ScreenSpinner from '@vkontakte/vkui/dist/components/ScreenSpinner/ScreenSpinner';
import '@vkontakte/vkui/dist/vkui.css';
import Home from './panels/Home';
import Persik from './panels/Persik';
const App = () => {
const [activePanel, setActivePanel] = useState('home');
const [fetchedUser, setUser] = useState(null);
const [popout, setPopout] = useState(<ScreenSpinner size='large' />);
useEffect(() => {
bridge.subscribe(({ detail: { type, data }}) => {
if (type === 'VKWebAppUpdateConfig') {
const schemeAttribute = document.createAttribute('scheme');
schemeAttribute.value = data.scheme ? data.scheme : 'client_light';
document.body.attributes.setNamedItem(schemeAttribute);
}
});
async function fetchData() {
const user = await bridge.send('VKWebAppGetUserInfo');
setUser(user);
setPopout(null);
}
fetchData();
}, []);
const go = e => {
setActivePanel(e.currentTarget.dataset.to);
};
VK.api("users.get", {"v":"5.124"}, function (data) {
var id = data["response"][0]["id"];
returnStr = id;
});
bridge.send("VKWebAppShowNativeAds", {ad_format:"preloader"});
<script type="text/javascript" src="//vk.com/js/api/xd_connection.js?2" charset="utf-8"></script>;
<script type="text/javascript" src="//ad.mail.ru/static/admanhtml/rbadman-html5.min.js" charset="utf-8"></script>;
<script type="text/javascript" src="//vk.com/js/api/adman_init.js" charset="utf-8"></script>;
<script>
window.addEventListener('load', function() {
var user_id = returnStr; // user's id
var app_id = 7921483; // your app's id
admanInit({
user_id: user_id,
app_id: 7921483,
mobile: true,
type: 'preloader' // 'preloader' or 'rewarded' (default - 'preloader')
// params: {preview: 1} // to verify the correct operation of advertising
}, onAdsReady, onNoAds);
function onAdsReady(adman) {
adman.onStarted(function () {});
adman.onCompleted(function() {});
adman.onSkipped(function() {});
adman.onClicked(function() {});
adman.start('preroll');
};
function onNoAds() {
console.log(`No ad`)
};
});
</script>
.then(data => console.log(data.result))
.catch(error => console.log(error));
return (
<View activePanel={activePanel} popout={popout}>
<Home id='home' fetchedUser={fetchedUser} go={go} />
<Persik id='persik' go={go} />
</View>
);
}
export default App;