Skip to content

Commit

Permalink
fix: no clue why this isn't building
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Feb 17, 2020
1 parent 0457244 commit 0d3e7fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
11 changes: 5 additions & 6 deletions packages/core/src/useForm.ts
@@ -1,6 +1,5 @@
import { computed, ref, Ref } from 'vue';
import { computed, ref, Ref, isRef } from 'vue';
import { Flag, FormController } from './types';
import { unwrap } from './utils';

const mergeStrategies: Record<Flag, 'every' | 'some'> = {
valid: 'every',
Expand Down Expand Up @@ -42,15 +41,15 @@ export function useForm(): FormComposite {
const fieldsById: Record<string, any> = {};
const values = computed(() => {
return fields.value.reduce((acc: any, field: any) => {
acc[unwrap(field.vid)] = field.value;
acc[isRef(field.vid) ? field.vid.value : field.vid] = field.value;

return acc;
}, {});
});

const names = computed(() => {
return fields.value.reduce((acc: any, field: any) => {
acc[unwrap(field.vid)] = field.vid;
acc[isRef(field.vid) ? field.vid.value : field.vid] = field.vid;

return acc;
}, {});
Expand All @@ -59,7 +58,7 @@ export function useForm(): FormComposite {
const controller: FormController = {
register(field) {
fields.value.push(field);
fieldsById[unwrap(field.vid)] = field;
fieldsById[isRef(field.vid) ? field.vid.value : field.vid] = field;
},
fields: fieldsById,
values,
Expand All @@ -78,7 +77,7 @@ export function useForm(): FormComposite {

const errors = computed(() => {
return fields.value.reduce((acc: Record<string, string[]>, field) => {
acc[unwrap(field.vid)] = field.errors.value;
acc[isRef(field.vid) ? field.vid.value : field.vid] = field.errors.value;

return acc;
}, {});
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/utils/common.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/utils/index.ts
Expand Up @@ -4,4 +4,3 @@ export * from './factories';
export * from './functions';
export * from './strings';
export * from './rules';
export * from './common';

0 comments on commit 0d3e7fd

Please sign in to comment.