SOLVED - 'Login redirect'

@thomas80559 I’ll take a look at this, but you’re not really coding this on the HIRE page, you’re code is in the Site code pane.

@yisrael-wix Yes, appologies I am coding on the site panel. I thought it best to do that as it allows members to login from any page??

@thomas80559 BTW - what is it doing right now? Are you testing in Preview or Live? The wix-users API does not work properly in Preview.

@thomas80559 copy my updated code above

@yisrael-wix When I publish the site I test in a seperate window and not preview. It allows you to log in but it just reverts back the the page you were viewing instead of directing the member to their dash/profile page depending on their role.

@thomas80559 JD’s code seems OK to me. Have you tried his updated code?

@yisrael-wix yes, that’s the one I’ve tried. Still no joy. J.D has been a great help on this. Losing the will to live with it though. i thougt it would have been simple. (I am a genuine novice with code Yisrael.)

@thomas80559 the screenshot you posted is not the updated code

@thomas80559 I think the code should be like this:

if(roles.some(r => {return(r.name === "Client")}) === true) { wixLocation.to("/client-dash"); };
if(roles.some(r => {return(r.name === "Professional")}) === true) { wixLocation.to("/candidate-dash"); };

Seems that a return is missing.
Disclaimer: not tested

@jonatandor35 I realised that after posting JD and ammended, sorry about that

@yisrael-wix I’m actually swearing right now - with joy !! Working !! Can’t thank you guys enough. I’ve been boggle eyed over this.

Guy, @yisrael-wix @J.D @givemeawhisky - Genuine thanks !!!

@jonatandor35 We got their JD, thank you !!

@thomas80559

No thanks for me, it all goes to J.D. and Yisrael on this one :+1::blush:

@givemeawhisky I think this calls for a drink. :beers: :tumbler_glass:

@yisrael-wix by the way, I don’t think the “return” is necessary there.

@yisrael-wix
Already did that last night, unfortunately it is soft drinks time for me now :scream:

@jonatandor35 @yisrael-wix @givemeawhisky after that I’d happily get you guys a drink !! I’m now moving on to task number 23, God help me :blush: !!

@thomas80559 :+1: good luck

@thomas80559 At least you can count them. :crazy_face:

@givemeawhisky soft drinks!? :exploding_head: