I want to open a new tab in which I make a call to a function from my own server (The one is below). The reason I want to do this is to be able to redirect the user from the server and not the frontend.
I don't know how to do this, but my server function is supposed to check if the user is registered to Stripe, if he is not, then I must redirect him to Stripe's website. I want to redirect using response.redirect.
My server is programmed in NodeJS and the function looks like this:
MyFunction = function (req,res) {
if (user has already integrated with stripe) {
return res.send(200)
}
else {
res.redirect('https://connect.stripe.com/oauth/authorize?response_type=code&client_id=CLIENT_ID&scope=read_write'))
}
}
How do I open a new tab from my controller and in that tab call for the function in the server?
See, the main problem is not opening the window, I have already seen the suggested solutions, it is how to, after opening it, making the http request to my server from that tab in ANGULAR.