Skip to content

Commit

Permalink
1,494th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Jun 28, 2024
1 parent 8366890 commit 31f4db2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useValdnLocale } from '@x/ui';
import { minLength, nullish, object, string } from 'valibot';
import { computed, toRef } from 'vue';
import { useValibotSchema } from 'vue-formor';
import { useSchema } from 'vue-formor';
import { useValdnLocale } from '@x/ui';
import * as v from 'valibot';

import useStore from './store';

Expand All @@ -10,10 +10,10 @@ export default () => {

const { state } = useStore();

const schema = useValibotSchema(
const schema = useSchema(
computed(() =>
object({
title: nullish(string([minLength(1, valdnLocale.value.required)]), ''),
v.object({
title: v.nullish(v.pipe(v.string(), v.minLength(1, valdnLocale.value.required)), ''),
}),
),
toRef(state, 'todoForm'),
Expand Down
19 changes: 13 additions & 6 deletions app/src/routes/(portal)/forgot-password/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useValdnLocale } from '@x/ui';
import { email, minLength, object, string } from 'valibot';
import { computed, toRef } from 'vue';
import { useValibotSchema } from 'vue-formor';
import { useSchema } from 'vue-formor';
import { useValdnLocale } from '@x/ui';
import * as v from 'valibot';

import useStore from './store';

Expand All @@ -10,10 +10,17 @@ export default () => {

const { state } = useStore();

const schema = useValibotSchema(
const schema = useSchema(
computed(() =>
object({
email: string([minLength(1, valdnLocale.value.required), email(valdnLocale.value.email)]),
v.object({
email: v.nullish(
v.pipe(
v.string(),
v.minLength(1, valdnLocale.value.required),
v.email(valdnLocale.value.email),
),
'',
),
}),
),
toRef(state, 'form'),
Expand Down
24 changes: 14 additions & 10 deletions app/src/routes/(portal)/sign-in/schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useValdnLocale } from '@x/ui';
import { minLength, object, string } from 'valibot';
import { computed, toRef } from 'vue';
import { useValibotSchema } from 'vue-formor';
import { useSchema } from 'vue-formor';
import { useLocaler } from 'vue-localer';
import { useValdnLocale } from '@x/ui';
import * as v from 'valibot';

import useStore from './store';

Expand All @@ -12,14 +12,18 @@ export default () => {

const { state } = useStore();

const schema = useValibotSchema(
const schema = useSchema(
computed(() =>
object({
username: string([minLength(1, valdnLocale.value.required)]),
password: string([
minLength(1, valdnLocale.value.required),
minLength(8, localer.f(valdnLocale.value.minLength, [8])),
]),
v.object({
username: v.nullish(v.pipe(v.string(), v.minLength(1, valdnLocale.value.required)), ''),
password: v.nullish(
v.pipe(
v.string(),
v.minLength(1, valdnLocale.value.required),
v.minLength(8, localer.f(valdnLocale.value.minLength, [8])),
),
'',
),
}),
),
toRef(state, 'signInForm'),
Expand Down

0 comments on commit 31f4db2

Please sign in to comment.