Need help with server actions
Answered
In&Out posted this in #help-forum
In&OutOP
Hello, so in my actions.ts, I have function that calls the supabase client, what I want to do now is to make errors as well to the login page which is a client component and I am not sure how to do that
25 Replies
In&OutOP
this is the current code, so what i want to do is check with zod if email is valid, and if it is, to use the validation success to change a state in login page (client file) or if error, to use validation.error for other state change
If there is other way, i can hear it
Just want to have error handling
doesnt even have to be with zod
In&OutOP
/bump
In&OutOP
message
American black bear
I am on mobile, so don't have the reference code
In&OutOP
thats fine, even a roadmap can help
American black bear
But what I currently have is I keep action functions in seperate file
I return response or error from that action
i was following this but it doesnt work for me, i am using supabase btw
@American black bear I return response or error from that action
In&OutOP
i did that but it doesnt work
Can you like, send me your code if you have it then i'll inspect?
American black bear
Hold on a min, lemme check on GitHub
American black bear
Answer
American black bear
Check these out
CreateCustomer is a server action in seperate fule
I am on discord mobile browser and it realy really sucks, so I may have uploaded more images than necessary
That customerformschema type is auto generated through inferring zode schema type BTW
@American black bear Click to see attachment
In&OutOP
you snuck a whole component inside form? bruh
lol
okay thank you