Skip to content

Commit

Permalink
Rename form to useForm in Vue 2 adapter and add to exports
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Sep 13, 2022
1 parent bdd32b1 commit ff59196
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/vue2/src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import form from './form'
import useForm from './useForm'
import remember from './remember'
import { createHeadManager, router } from '@inertiajs/core'

Expand Down Expand Up @@ -84,7 +84,7 @@ export default {

export const plugin = {
install(Vue) {
router.form = form // needed so that we can access the form helper at this.$inertia.form
router.form = useForm // needed so that we can access the form helper at this.$inertia.form
Vue.mixin(remember)

Vue.mixin({
Expand Down
1 change: 1 addition & 0 deletions packages/vue2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as App, plugin } from './app'
export { default as createInertiaApp } from './createInertiaApp'
export { default as Head } from './head'
export { default as Link } from './link'
export { default as useForm } from './useForm'
2 changes: 1 addition & 1 deletion packages/vue2/src/form.js → packages/vue2/src/useForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import isEqual from 'lodash.isequal'
import cloneDeep from 'lodash.clonedeep'
import { router } from '@inertiajs/core'

export default function (...args) {
export default function useForm(...args) {
const rememberKey = typeof args[0] === 'string' ? args[0] : null
const data = (typeof args[0] === 'string' ? args[1] : args[0]) || {}
const restored = rememberKey ? router.restore(rememberKey) : null
Expand Down

0 comments on commit ff59196

Please sign in to comment.