javascript - Syntax error : Unexpected identifier -


i making chrome extension , have problems

i want make fetch() anilist.co , avoid problems, want use await have syntax error :

https://i.imgur.com/icygref.png

here code :

async function getanimeprogress(animeid) {     var result;     chrome.storage.local.get('access_token', function (items) {         var query = `         query ($id: int, $page: int) {           page (page: $page) {             media (id: $id) {               id               medialistentry {                   status                   progress               }             }           }         }         `;         var variables = {             id: animeid,             page: 1         };         var url = 'https://graphql.anilist.co',             options = {                 method: 'post',                 headers: {                     'content-type': 'application/json',                     'accept': 'application/json',                     'authorization': 'bearer ' + items['access_token'],                 },                 body: json.stringify({                     query: query,                     variables: variables                 })             };         function handleresponse(response) {             console.log('handleresponse exec !');             result = response;         };         function handleerror(e) {             console.error(e);         };         await fetch(url, options).then(handleresponse).catch(handleerror);     });     return result; } 

are supposed have single quote in these lines: var query = ; seems making query var string.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -