-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
n98: refactor: Migrate from yup to zod
- Loading branch information
1 parent
973bf2b
commit 868a7d0
Showing
19 changed files
with
156 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import * as yup from "yup" | ||
import { z } from "zod" | ||
|
||
export enum FieldName { | ||
Password = "password", | ||
Username = "username", | ||
} | ||
|
||
export const validationSchema = yup | ||
.object({ | ||
[FieldName.Password]: yup.string().required(), | ||
[FieldName.Username]: yup.string().required(), | ||
}) | ||
.required() | ||
export const validationSchema = z.object({ | ||
[FieldName.Password]: z.string().nonempty(), | ||
[FieldName.Username]: z.string().nonempty(), | ||
}) | ||
|
||
export const defaultValues: TFormValues = { | ||
password: "", | ||
username: "", | ||
} | ||
export type TFormValidValues = z.infer<typeof validationSchema> | ||
|
||
export type TFormDefaultValues = TFormValidValues | ||
|
||
export type TFormValues = yup.InferType<typeof validationSchema> | ||
export const defaultValues: TFormValidValues = { | ||
[FieldName.Password]: "", | ||
[FieldName.Username]: "", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.