I need to send the user of my application to the coinbase authorization page. My application uses an Ember.js front end and is connected to a Ruby on Rails back end. I have been able to execute this functionality using rails views before, but I am having trouble doing so using an external client. Client side, I have constructed an adapter which runs the requisite server side functions to generate an authorize. When I click the button which fires this adapter and I am returned a correct redirect url, but my app throws a 404. I am fairly certain I need to use the method window.location.replace(redirect_url)
to launch this redirect, but I cannot seem to figure out the syntax for properly returning the value and plugging it into this call.
the method called in the route:
donate (params) {
return this.get('store').findAll('account', {reload:true})
.then((accounts) => {
return accounts.findBy('editable', true);
})
.then((account) => {
params.patronId = account.id;
const adapter = this.store.adapterFor('account');
// adapter.donate(params);
return adapter.recieve_donation(params);
})
// .then(() => this.transitionTo('accounts.search-accounts'))
.then(() => {
this.get('flashMessages')
.success('We have successfully sent your donation');
});
},
the adapter method:
recieve_donation(params){
console.log(params);
const api = this.get('host');
const url = `${api}/auth/coinbase`;
// , {data: params}
return this.ajax(url, 'GET');
},
I also am not sure if the problem is on my server side; my intuition says the fact that I am successfully returning a url leads me to believe it is not, but I can't be sure.
How can I redirect my ember app to the returned redirect URL?
Aucun commentaire:
Enregistrer un commentaire