import { saveUser } from '~api'

import { NameField } from './0.NameField.ts'
import { SaveButton } from './1.SaveButton.ts'

const $form = createStoreObject({
  name: NameField.$value
})

forward({
  from: sample($form, SaveButton.pressed),
  to: saveUser
})

const Form = () => {
  return <form onSubmit={SaveButton.pressed}>
    <NameField />
    <SaveButton />
  </form>
}