diff --git a/apps/web/pages/templates/index.tsx b/apps/web/pages/templates/index.tsx index 78799a4..2f71c7b 100644 --- a/apps/web/pages/templates/index.tsx +++ b/apps/web/pages/templates/index.tsx @@ -24,7 +24,7 @@ import { import styled from '@emotion/styled'; -import { parse, object, array, string, transform, nullable } from 'valibot'; +import { parse, object, array, string } from 'valibot'; import Fuse from 'fuse.js'; @@ -55,17 +55,6 @@ type Template = Templates[number]; const schemas = { names: string(), - cacheOrdinaryTemplates: transform( - nullable( - array( - object({ - name: string(), - content: string(), - }) - ) - ), - Optional.from - ), selectedOrdinaryTemplatesId: array( object({ value: string(), diff --git a/apps/web/src/api/scrapper/index.ts b/apps/web/src/api/scrapper/index.ts index c62568a..71fb2df 100644 --- a/apps/web/src/api/scrapper/index.ts +++ b/apps/web/src/api/scrapper/index.ts @@ -2,25 +2,28 @@ import { AsyncOperation, Defined } from '@poolofdeath20/util'; import axios from 'axios'; -import { parse, object, array, string, transform } from 'valibot'; +import { parse, object, array, string, transform, pipe } from 'valibot'; import { singleFlowParser } from '../../common/parser'; const schemas = { - latestTimeCommitted: transform(string(), (value) => { - return new Date(value); - }), + latestTimeCommitted: pipe( + string(), + transform((value) => { + return new Date(value); + }) + ), template: { properties: { content: string(), }, list: array( - transform( + pipe( object({ path: string(), }), - ({ path }) => { + transform(({ path }) => { return path; - } + }) ) ), },