mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-12 18:43:50 +00:00
refactor(#65): add types to products page params
This commit is contained in:
@@ -3,11 +3,11 @@ import { getActiveProductsWithPrices } from '$lib/utils/supabase/admin';
|
|||||||
import logger from '$lib/utils/logger/logger';
|
import logger from '$lib/utils/logger/logger';
|
||||||
|
|
||||||
export const GET = async ({ url }) => {
|
export const GET = async ({ url }) => {
|
||||||
const limitParam = url.searchParams.get('limit');
|
const limitParam: string | null = url.searchParams.get('limit');
|
||||||
const offsetParam = url.searchParams.get('offset');
|
const offsetParam: string | null = url.searchParams.get('offset');
|
||||||
try {
|
try {
|
||||||
const limit = limitParam ? parseInt(limitParam, 10) : 10;
|
const limit = limitParam ? Number.parseInt(limitParam, 10) : 10;
|
||||||
const offset = offsetParam ? parseInt(offsetParam, 10) : 0;
|
const offset = offsetParam ? Number.parseInt(offsetParam, 10) : 0;
|
||||||
|
|
||||||
const { products, count } = await getActiveProductsWithPrices(limit, offset);
|
const { products, count } = await getActiveProductsWithPrices(limit, offset);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user