From 07b75f473929e01dd13aac556243e35db611bb53 Mon Sep 17 00:00:00 2001 From: Hugues Chocart Date: Mon, 15 Apr 2024 21:38:53 -0300 Subject: [PATCH] fix: decimal number deserialization in checks (#228) --- packages/shared/checks/serialize.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/shared/checks/serialize.ts b/packages/shared/checks/serialize.ts index 24e90bae..8ad4de9f 100644 --- a/packages/shared/checks/serialize.ts +++ b/packages/shared/checks/serialize.ts @@ -1,3 +1,4 @@ +import { fileURLToPath } from "url" import type { CheckLogic, CheckParam } from "." import { CHECKS } from "." @@ -29,21 +30,22 @@ const paramSerializer = (param: CheckParam, value: any) => { function deserializeParamValue( filterParam: CheckParam, - v: string, + value: string, ): any | undefined { + console.log(value, filterParam.type) switch (filterParam.type) { case "select": if (filterParam.multiple) { - return v.split(",").map(decodeURIComponent) + return value.split(",").map(decodeURIComponent) } else { - return decodeURIComponent(v) + return decodeURIComponent(value) } case "text": - return decodeURIComponent(v) + return decodeURIComponent(value) case "number": - return Number(v) + return Number(decodeURIComponent(value)) case "date": - return new Date(Number(v)) + return new Date(Number(value)) default: return undefined }