react-form-action 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/client.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ const i18nMiddleware = async () => {
|
|
|
50
50
|
const authAction = formAction
|
|
51
51
|
.use(i18nMiddleware)
|
|
52
52
|
.use(async ({ ctx: { t } }) =>
|
|
53
|
-
console.log("🎉 context enhanced by previous middlewares 🎉", t)
|
|
53
|
+
console.log("🎉 context enhanced by previous middlewares 🎉", t),
|
|
54
54
|
)
|
|
55
55
|
.error(({ error }) => {
|
|
56
56
|
if (error instanceof DbError) {
|
|
@@ -85,7 +85,7 @@ export const signUp = authAction
|
|
|
85
85
|
.refine((data) => data.password === data.confirm, {
|
|
86
86
|
message: "Passwords don't match",
|
|
87
87
|
path: ["confirm"],
|
|
88
|
-
})
|
|
88
|
+
}),
|
|
89
89
|
) // if using refinement, only one input call is permited, as schema with ZodEffects is not extendable.
|
|
90
90
|
.run(async ({ ctx: { t }, input: { email, password } }) => {
|
|
91
91
|
// 🎉 passwords match!
|
|
@@ -161,7 +161,7 @@ export const updateUser = createFormAction<
|
|
|
161
161
|
|
|
162
162
|
return failure({ message: "Failed to update user." });
|
|
163
163
|
}
|
|
164
|
-
}
|
|
164
|
+
},
|
|
165
165
|
);
|
|
166
166
|
```
|
|
167
167
|
|
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import d from"react";import{useActionState as u}from"react";function c(t){return{type:"initial",data:t,error:null,validationError:null}}var i={isInitial:!1,isInvalid:!1,isFailure:!1,isSuccess:!1};function P({children:t,action:a,initialData:n,permalink:e,...o}){let[r,l,p]=u(a,c(n),e),m=r.type==="initial"?{...r,...i,isInitial:!0}:r.type==="invalid"?{...r,...i,isInvalid:!0}:r.type==="failure"?{...r,...i,isFailure:!0}:{...r,...i,isSuccess:!0};return d.createElement("form",{action:l,...o},t({...m,isPending:p}))}import{useFormStatus as E}from"react-dom";function D({children:t}){return t(E())}import s from"react";var f=".",F=Object.freeze({_errors:Object.freeze([])});function v({errors:t,name:a="",children:n=({errors:e})=>s.createElement(s.Fragment,null,e[0])}){if(a.length===0)return n({errors:t._errors});let e=a.split(f),o=t;for(;e.length;){let r=e.shift();o=o[r]??F}return n({errors:o._errors})}export{P as Form,D as FormStatus,v as ZodFieldError,c as initial};
|