Passing error from server side to client side (invite code verification)

I have a simple register page with a user name and password and an invite code input field. I’ve managed to develop the server side stuff with a condition that only adds a user to the database if it matches the invite
code that I set. All fine.

However, when the user’s invite code is not matched, what is the best way to notify the user? In other words, how can I pass on this error code to the client side?

Can someone point me in the right direction?

In your server action you can add a step within your condition that sends a 401 HTTP Unathorized response if the code doesn’t match.

On app connect you can add an alert to your page using dmx-show on the Unauthorized event.

3 Likes

Thanks, that works wonderfully.

1 Like