Server Connect Trigger Redirect

I have a Node site setup a database query.
I have a condition that sets a value in a database update and outputs another value.

I have an Action Scheduler running every few minutes and I would like upon the condition being met (loggedin == ‘3’) that it redirects to the redirectURL value

I have added the browser component, but am struggling to get the redirect when the condition is met.

Any pointers would be appreciated.
Thanks in advance

1 Like

OK, if no one has any ideas.
Can someone please explain what the server connect redirect action does in this context?

It’s actually pretty easy to do. All you need is to check the setvalue step value and if it matches what you need then do redirect, otherwise don’t.

So using the dynamic events (on done) of the server connect on the page:

dmx-on:done="serverconnect1.data.loggedin == 3 ? browser1.goto('my_page.html') : false"

just replace the serverconnect1 with the name of your actual server action.

2 Likes

There was a discussion about this here. I don’t know about NodeJS, but the redirect step seems to work as you would expect with PHP. @Teodor confirms this in the discussion referred to, but @George recommends not using it in this way. I don’t know why this is. It would seem a more obvious and often simpler approach. Perhaps it doesn’t work in some cases.