Fetch for each result of a Fetch

I could really use a few pointers regarding Fetching for each result of a Fetch.
This code is in the backend.js, in the context.js I just want to load the Observable with resulting tree.

The fetchFriends function returns a list of userid’s
I want to place these userids in a Tree and then do a new fetch on each of the these userids from the first fetch and add them to the tree.

For further handing, it’s only important that the first fetch has index 0 in the tree. The next fetches can be stored in any order.

As always any help highly appreciated.

var friendsGetUrl = 'https:/u.rl?user_id=';

var newTree = function(){

	return new(function(){
		var nodes = [];

		this.add = function (node) {
			nodes.push(node);
			return this;
		};

		this.getTree = function() {
           return nodes;
        };

	});
}


function fetchFriends(userid){
    return fetch(friendsGetUrl + userid.value)
		.then(function(result) {
			
			return result.json();
		})

		.then(function(resultJson) {

			return resultJson.response;
		})
		.catch(function(err) {
			console.log("err_backend" + err);
		});
}


function buildTree(userid){
	return new Promise(function(resolve, reject) {

		fetchFriends(userid);
		
		resolve (function(result) {
			 var tree = newTree();
				tree.add({
				name: userid.value,
				data: result
			});
			return tree.getTree();
		});

	});
}