Files
remanso/src/hooks/useForm.hook.ts
2023-08-06 18:58:59 +02:00

29 lines
472 B
TypeScript

import { ref } from 'vue'
import { useRouter } from 'vue-router'
export const useForm = () => {
const userInput = ref('')
const repoInput = ref('')
const { push } = useRouter()
const submit = () => {
if (!userInput.value || !repoInput.value) {
return
}
push({
name: 'FluxNoteView',
params: {
user: userInput.value,
repo: repoInput.value
}
})
}
return {
userInput,
repoInput,
submit
}
}