1๐
โ
You need to use the ` symbol to use template strings
execute() {
this.$gapi
.request({
path:
"https://www.googleapis.com/drive/v3/files/1xTvsBoqCiKE5XfSRklRPBWMbkCtdJSnzGEdT7B76TZM/copy",
method: "POST"
})
.then(response => {
console.log(response);
let documentId = response.result.id;
let imieUcznia = "Alice";
let requests = [
{
replaceAllText: {
containsText: {
text: "{{imieUcznia}}",
matchCase: true
},
replaceText: imieUcznia
}
}
];
this.$gapi
.request({
path:
`https://docs.googleapis.com/v1/documents/${documentId}:batchUpdate`, // <-- here
method: "POST",
body: {
requests
}
})
.then(response => {
console.log(response);
});
});
},
๐คMorphyish
2๐
You can use Javascript Template Literals ie use ` instead of โ
path: `https://docs.googleapis.com/v1/documents/${documentId}:batchUpdate`,
// ^ Observe here
๐คvatz88
Source:stackexchange.com