Skip to content

Commit

Permalink
fix(demo): lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuagraber committed Jun 18, 2024
1 parent 7ef1859 commit fed5790
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/Form/PdapForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:name="name"
class="pdap-form"
@change="change"
@submit.prevent="submit($event)"
@submit.prevent="submit()"
>
<div
v-if="typeof errorMessage === 'string'"
Expand Down Expand Up @@ -140,7 +140,7 @@ function change() {
emit('change', { ...values.value });
}
async function submit(event: Event) {
async function submit() {
// Check form submission
const isValidSubmission = await v$.value.$validate();
if (isValidSubmission) {
Expand Down
17 changes: 10 additions & 7 deletions src/demo/pages/SignupFormDemo.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<template>
<main>
<Form
id="bar"
:error="error"
:schema="SCHEMA"
:reset-on="reset"
name="foo"
@submit="onSubmit"
@change="handleChangeOnError"
>
Expand All @@ -13,6 +15,7 @@
</template>

<script setup lang="ts">
import { PdapInputTypes } from 'src/components/Input/types';
import { Button, Form } from '../../components';
import { ref } from 'vue';
Expand All @@ -23,7 +26,7 @@ const SCHEMA = [
id: 'email',
name: 'email',
label: 'Email',
type: 'text',
type: PdapInputTypes.TEXT,
placeholder: 'Your email address',
value: '',
validators: {
Expand All @@ -38,7 +41,7 @@ const SCHEMA = [
id: 'password',
name: 'password',
label: 'Password',
type: 'password',
type: PdapInputTypes.PASSWORD,
placeholder: 'Your password',
value: '',
validators: {
Expand All @@ -53,7 +56,7 @@ const SCHEMA = [
id: 'confirmPassword',
name: 'confirmPassword',
label: 'Confirm Password',
type: 'password',
type: PdapInputTypes.PASSWORD,
placeholder: 'Confirm your password',
value: '',
validators: {
Expand All @@ -65,13 +68,13 @@ const SCHEMA = [
},
];
const error = ref(undefined);
const error = ref<undefined | string>(undefined);
const reset = ref(false);
/**
* When signing up: handles clearing pw-match form errors on change if they exist
*/
function handleChangeOnError(formValues) {
function handleChangeOnError(formValues: Record<string, string>) {
console.debug('onchange', { e: error.value, formValues: formValues.value });
if (error.value && formValues.password !== formValues.confirmPassword) {
Expand All @@ -83,7 +86,7 @@ function handleChangeOnError(formValues) {
* When signing up: validates that passwords match
* @returns {boolean} `false` if passwords do not match, `true` if they do
*/
function handlePasswordValidation(formValues) {
function handlePasswordValidation(formValues: Record<string, string>) {
console.debug('validate', { e: error.value });
if (formValues.password !== formValues.confirmPassword) {
Expand All @@ -100,7 +103,7 @@ function handlePasswordValidation(formValues) {
/**
* Logs user in or signs user up
*/
function onSubmit(formValues) {
function onSubmit(formValues: Record<string, string>) {
console.debug('onsubmit', { e: error.value });
if (!handlePasswordValidation(formValues)) {
return;
Expand Down

0 comments on commit fed5790

Please sign in to comment.