Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side zod schema #5

Closed
fsiatama opened this issue Feb 24, 2024 · 2 comments
Closed

Server side zod schema #5

fsiatama opened this issue Feb 24, 2024 · 2 comments

Comments

@fsiatama
Copy link

Hello,

I've encountered an issue when using server actions with Next.js and attempting to validate phone numbers on the server side.

Currently, the documentation/code suggests using:

import { isValidPhoneNumber } from "react-phone-number-input";

However, this import is client-side oriented and might not be suitable for server-side validations due to its dependency on the react-phone-number-input package, which is primarily designed for client-side React applications.

For server-side validations within Next.js server actions, it's more appropriate to use:

import { isValidPhoneNumber } from 'libphonenumber-js';

@omeralpi
Copy link
Owner

omeralpi commented Mar 5, 2024

@fsiatama I opened an issue in the React Phone Number Input repository.

And the creator of the package responded as follows:

Hmm, I see. Well, in that case just import the validation functions from libphonenumber-js package because all those functions are simply re-exported from that package.

libphonenumber-js package is a dependency of react-phone-number-input and is automatically installed.

@ahkhanjani
Copy link
Contributor

Hi,

I think this could be mentioned in the readme for the time being.

@fsiatama fsiatama closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants