mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
chore: update packages
also migrate zod to v4
This commit is contained in:
parent
afb73ec3a6
commit
8b4842b584
20 changed files with 918 additions and 922 deletions
|
|
@ -36,15 +36,15 @@ const searchSchema = z.object({
|
|||
// todo: incorporate tagsSchema
|
||||
// Pages
|
||||
limit: z.coerce
|
||||
.number({ message: "Limit must be a number" })
|
||||
.int({ message: "Limit must be an integer" })
|
||||
.min(1, { message: "Limit must be at least 1" })
|
||||
.max(100, { message: "Limit cannot be more than 100" })
|
||||
.number({ error: "Limit must be a number" })
|
||||
.int({ error: "Limit must be an integer" })
|
||||
.min(1, { error: "Limit must be at least 1" })
|
||||
.max(100, { error: "Limit cannot be more than 100" })
|
||||
.optional(),
|
||||
page: z.coerce
|
||||
.number({ message: "Page must be a number" })
|
||||
.int({ message: "Page must be an integer" })
|
||||
.min(1, { message: "Page must be at least 1" })
|
||||
.number({ error: "Page must be a number" })
|
||||
.int({ error: "Page must be an integer" })
|
||||
.min(1, { error: "Page must be at least 1" })
|
||||
.optional(),
|
||||
});
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ export default async function MiiList({ searchParams, userId, inLikesPage }: Pro
|
|||
const session = await auth();
|
||||
|
||||
const parsed = searchSchema.safeParse(searchParams);
|
||||
if (!parsed.success) return <h1>{parsed.error.errors[0].message}</h1>;
|
||||
if (!parsed.success) return <h1>{parsed.error.issues[0].message}</h1>;
|
||||
|
||||
const { q: query, sort, tags, page = 1, limit = 24 } = parsed.data;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export default function ProfileSettings() {
|
|||
const handleSubmitDisplayNameChange = async (close: () => void) => {
|
||||
const parsed = displayNameSchema.safeParse(displayName);
|
||||
if (!parsed.success) {
|
||||
setDisplayNameChangeError(parsed.error.errors[0].message);
|
||||
setDisplayNameChangeError(parsed.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ export default function ProfileSettings() {
|
|||
const handleSubmitUsernameChange = async (close: () => void) => {
|
||||
const parsed = usernameSchema.safeParse(username);
|
||||
if (!parsed.success) {
|
||||
setUsernameChangeError(parsed.error.errors[0].message);
|
||||
setUsernameChangeError(parsed.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ export default function EditForm({ mii, likes }: Props) {
|
|||
// Validate before sending request
|
||||
const nameValidation = nameSchema.safeParse(name);
|
||||
if (!nameValidation.success) {
|
||||
setError(nameValidation.error.errors[0].message);
|
||||
setError(nameValidation.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
const tagsValidation = tagsSchema.safeParse(tags);
|
||||
if (!tagsValidation.success) {
|
||||
setError(tagsValidation.error.errors[0].message);
|
||||
setError(tagsValidation.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ export default function SubmitForm() {
|
|||
// Validate before sending request
|
||||
const nameValidation = nameSchema.safeParse(name);
|
||||
if (!nameValidation.success) {
|
||||
setError(nameValidation.error.errors[0].message);
|
||||
setError(nameValidation.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
const tagsValidation = tagsSchema.safeParse(tags);
|
||||
if (!tagsValidation.success) {
|
||||
setError(tagsValidation.error.errors[0].message);
|
||||
setError(tagsValidation.error.issues[0].message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export default function UsernameForm() {
|
|||
|
||||
const handleSubmit = async () => {
|
||||
const parsed = usernameSchema.safeParse(username);
|
||||
if (!parsed.success) setError(parsed.error.errors[0].message);
|
||||
if (!parsed.success) setError(parsed.error.issues[0].message);
|
||||
|
||||
const response = await fetch("/api/auth/username", {
|
||||
method: "PATCH",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue