diff --git a/packages/app/src/fetch.ts b/packages/app/src/fetch.ts index c116fe7d..fd6ef44d 100644 --- a/packages/app/src/fetch.ts +++ b/packages/app/src/fetch.ts @@ -29,6 +29,8 @@ export async function fetchResources( fansub?: number; publisher?: number; type?: string; + after?: Date; + before?: Date; } = {} ) { return ( @@ -43,7 +45,9 @@ export async function fetchResources( : undefined, fansub: options.fansub ? '' + options.fansub : undefined, publisher: options.publisher ? '' + options.publisher : undefined, - type: options.type ? '' + options.type : undefined + type: options.type ? '' + options.type : undefined, + after: options.after, + before: options.before }) ).resources; } diff --git a/packages/app/src/pages/resources/[page].astro b/packages/app/src/pages/resources/[page].astro index 3e5633f0..e8b2dfd1 100644 --- a/packages/app/src/pages/resources/[page].astro +++ b/packages/app/src/pages/resources/[page].astro @@ -15,6 +15,11 @@ const fansub = url.searchParams.get('fansub'); const _type = url.searchParams.get('type'); const type = _type && _type in QueryType ? QueryType[_type] : _type; +const _after = url.searchParams.get('after'); +const after = _after ? new Date(_after) : undefined; +const _before = url.searchParams.get('before'); +const before = _before ? new Date(_before) : undefined; + const _include = url.searchParams.get('include'); const include = _include ? JSON.parse(_include) : undefined; const _exclude = url.searchParams.get('exclude'); @@ -25,7 +30,9 @@ const resources = await fetchResources(page, { fansub: fansub ? +fansub : undefined, type: type ? type : undefined, include, - exclude + exclude, + after, + before }); ---