Reactive Web Application - Server Actions verses Fetch Data from Database

Hello,

I am creating a web application that has a Landing Page where any potential customer will have the ability to log in or create an username. With that said, I have logic on this page that fetches the username data from the server to identify if the Customer has a account with the company. 

Since I would need to do this type of functionality several other places, I figured I would create a Server Action that will pass in the username entered by the customer to determine if the Customer exists. This would also be great for passing back the name and few other information to personalize the page at that point.

When I added the Server action, I receive warning that this will exposes.... and that it would be best to check the anonymous button. I am use to the Traditional web so that is why I was going to create this Server action. My question is this, when having page where you are expecting pretty much anyone to attempt to log in, is it better not to use Server Actions and Data Fetch instead?

Thanks in advance



Solution

Hi Otis,

You get that warning because the call to the server action is public so can be done by anybody knowing the URL, as there is no logged-in user. So you have to decide for yourself if that is ok in your situation. Changing the Server action with a Data Fetch does not solve your problem.

Background information:

Regards,

Daniel

Solution