Я пытаюсь создать Календарь Google в Wix. Я хочу вставить событие через форму.
- Я не могу импортировать внешние JS.
или же
- Я не могу опубликовать код вставки в googleApi
import {fetch} from 'wix-fetch';
$w.onReady(function name () {
var start = "2018-11-01T10:00:00";
var end = "2018-11-01T12:00:00";
sendWithService("0","namesurname", "location", start, end, "note")
})
//sendGrid.js
export function sendWithService(id,adisoyadi, lokasyon, start, end, not) {
const url = "https://api.sendgrid.com/api/mail.send.json";
const headers = {
"apiKey": apiKey,
"clientId": id,
"scope": 'https://www.googleapis.com/auth/calendar',
"discoveryDocs": ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest']
};
const data = 'id :' +id "+ ',Description:' + adisoyadi + ', Location:'+lokasyon+' ,Start: ' + start +',End: ' + end+'}';
//DateTime: "2015-05-28T09:00:00-07:00",
const request = {
"method": "post",
"headers": headers,
"body": data
};
return fetch(url, request)
.then(response => response.json());
}