diff options
| author | Dhravya Shah <[email protected]> | 2024-06-18 17:58:46 -0500 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2024-06-18 17:58:46 -0500 |
| commit | f4bb71e8f7e07bb2e919b7f222d5acb2905eb8f2 (patch) | |
| tree | 7310dc521ef3559055bbe71f50c3861be2fa0503 /apps/web/lib/searchParams.ts | |
| parent | darkmode by default - so that the colors don't f up on lightmode devices (diff) | |
| parent | Create Embeddings for Canvas (diff) | |
| download | supermemory-default-darkmode.tar.xz supermemory-default-darkmode.zip | |
Diffstat (limited to 'apps/web/lib/searchParams.ts')
| -rw-r--r-- | apps/web/lib/searchParams.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/web/lib/searchParams.ts b/apps/web/lib/searchParams.ts new file mode 100644 index 00000000..9899eaf7 --- /dev/null +++ b/apps/web/lib/searchParams.ts @@ -0,0 +1,26 @@ +import { + createSearchParamsCache, + parseAsInteger, + parseAsString, + parseAsBoolean, + parseAsArrayOf, + parseAsJson, +} from "nuqs/server"; +import { z } from "zod"; + +export const homeSearchParamsCache = createSearchParamsCache({ + firstTime: parseAsBoolean.withDefault(false), +}); + +export const chatSearchParamsCache = createSearchParamsCache({ + firstTime: parseAsBoolean.withDefault(false), + q: parseAsString.withDefault(""), + spaces: parseAsArrayOf( + parseAsJson(() => + z.object({ + id: z.string(), + name: z.string(), + }), + ), + ).withDefault([]), +}); |