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

[0.5.x] Support Inertia transform #72

Merged
merged 3 commits into from
Jun 4, 2024
Merged

[0.5.x] Support Inertia transform #72

merged 3 commits into from
Jun 4, 2024

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented Jun 4, 2024

Fixes #70

Adds support for Inertia's transform function.

const form = useForm('post', '/register', {
    emails: ''
}).transform(data => ({
    ...data,
    emails: data.emails.split(',').map(email => email.trim()),
})

form.emails = '[email protected], [email protected]'

form.validate('emails') // { emails: ['tim@laravel.com', '[email protected]'] }
form.submit()           // { emails: ['tim@laravel.com', '[email protected]'] }

@timacdonald timacdonald marked this pull request as ready for review June 4, 2024 01:19
@gcaraciolo
Copy link

hey, @timacdonald. Thanks for implementing this.

@taylorotwell taylorotwell merged commit 38d27b9 into main Jun 4, 2024
2 checks passed
@taylorotwell taylorotwell deleted the transform branch June 4, 2024 13:28
@timacdonald
Copy link
Member Author

No worries. Thanks for reporting the issue.

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

Successfully merging this pull request may close these issues.

inertia-vue - Use transformed data when validating
3 participants