HI, I was tasked with making an HTML and javascript page so that people could just type in some information and then just be given a link to their scheduled meeting.
I am using JWT as it seemed to be easier for the two to use.
I know fetch() is throwing me an error. that error being TypeError: NetworkError when attempting to fetch resource. but at this point, I am just wondering if I am calling it correctly.
I would use a screenshot of the code, but I can’t upload pictures. so I am just going to copy-paste it here. I have removed my methods of creating the JWT token for safety reasons
var date
var time
var topics
var Password
var Dura
var josnbody
var combine
var url
var email
var sJWT
document.getElementById(“myBtn”).onclick = function () { GrabV };
document.getElementById(“myBtn”).addEventListener(“click”, GrabV)
function GrabV() {
email = document.getElementById(“email”).value
date = document.getElementById(“date”).value
time = document.getElementById(“time”).value
topics = document.getElementById(“topic”).value
Password = document.getElementById(“Password”).value
Dura = document.getElementById(“duration”).value
Dura = parseInt(Dura)
combine = date + “T” + time
MakeToken()
}
function MakeToken() {
MakeJson()
}
function MakeJson() {
jsonbody = {
"topic": topics,
"type": 2,
"start_time": combine,
"duration": Dura,
"password": Password,
"timezone": 'America/New_York',
"settings": {
"host_video": true,
"participant_video": true,
"join_before_host": false,
"mute_upon_entry": true,
}
}
Func()
}
function Func() {
url = ‘https://api.zoom.us/v2/users/’ + email + ‘/meetings’
var jboy = JSON.stringify(josnbody)
var head = new Headers();
head.append(‘Content-Type’, ‘application/json’);
head.append(‘authorization’, ‘Bearer’ + sJWT);
var initObject = {
method: 'POST', headers: head, body: jboy
}
var input = new Request(url, initObject)
fetch(input)
.then(function (repsonse) {
return response.json();
})
.then(function (data) {
console.log(data);
})
.catch(function (err) {
console.log("Something went wrong!", err);
});
}