Answer the question
In order to leave comments, you need to log in
How to make a request to a url, wait for a response and send a request to another url?
there is a Promise
this.get('api').getUser(userId) after it is executed, take data from it make another request
this.get('api').getUserLogo(piece of url "api/user/logo/1" ) and then return everything, I have already re-read a bunch of everything but did not understand how it is done
Can you help
Answer the question
In order to leave comments, you need to log in
// SHARE BTN
//===============js======================
function socialopen(url){
var winpar='width=500,height=400,left=' + ((window.innerWidth - 500)/2) + ',top=' + ((window.innerHeight - 400)/2) ;
window.open(url,'tvkw',winpar);
}
$('a.bt').click(function(){
var url = $(this).attr('href');
socialopen(url);
return false;
});
//===============html=====================
<ul class="social_share">
<li>
<a class="bt" href="https://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>">
<i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="bt" href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&title=<?php the_title(); ?>">
<i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="bt" href="http://vkontakte.ru/share.php?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>">
<i class="fa fa-vk" aria-hidden="true"></i>
</a>
</li>
</ul>
The list with the .social_share class is inserted into each specific entry in the loop.
return this.get('api').getUser(userId).then(user => {
return Ember.RSVP.hash({
user,
logo: this.get('api').getUserLogo(кусок url "api/user/logo/1")
});
});
Stanislav Romanov
Rather like this, according to the pattern
Promice.resolve().then( () => {
return this.get( 'api').getUser( userId)
}).then( user => {
return Ember.RSVP.hash({
user,
logo: this.get( 'api').getUserLogo( кусок url "api/user/logo/1")
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question