Api js put and delete

Hi, I tried to follow and unfollow with JS, but gives me follow or remove it, could you help?
my code:

    function follower(){
			Twitch.api({method: 'user'}, function (error, user) {
			  if (error) console.log("ERROR");
			var channel = "";
			  Twitch.api({  method: 'users/'+user.name+'/follows/channels/'+channel ,verb: 'PUT'}, function (error, response) {
				if (error) console.log(error);
		
				if(response) console.log(response);
			  });
			});
			
		}

function unfollow(){
			Twitch.api({method: 'user'}, function (error, user) {
			  if (error) console.log("ERROR");
			var channel = "";
			  Twitch.api({  method: 'users/'+user.name+'/follows/channels/'+channel ,verb: 'DELETE'}, function (error, response) {
				if (error) console.log(error);
		
				if(response) console.log(response);
			  });
			});
			
		}

Thx to Help! im can GET but no PUT AND DELETE!

Are you populating the channel variable? What is the developer console output? What is shown in the Network tab of the developer console for the API call?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.