web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit d19ea5cff868d42a8829984c0836902c7b001011
parent a2bfaf2cc797c8a7e8943cb3733e9877a0dfa82c
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Fri,  7 Mar 2025 10:21:22 +0000

apps-lib: update callback route util, add types to query param stores

Diffstat:
Mapps-lib/src/lib/store/client.ts | 14+++++++-------
Mapps-lib/src/lib/util/lib.ts | 4++--
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/apps-lib/src/lib/store/client.ts b/apps-lib/src/lib/store/client.ts @@ -1,14 +1,14 @@ -import type { NavigationPreviousParam } from "@radroots/util"; +import type { NavigationPreviousParam, NavigationRouteParamField, NavigationRouteParamId, NavigationRouteParamLat, NavigationRouteParamLng, NavigationRouteParamNostrPublicKey, NavigationRouteParamRef } from "@radroots/util"; import { writable } from "svelte/store"; import { queryParam, queryParameters } from "sveltekit-search-params"; export const qp = queryParameters(); -export const qp_id = queryParam<string>("id"); -export const qp_ref = queryParam<string>("ref"); -export const qp_lat = queryParam<string>("lat"); -export const qp_lng = queryParam<string>("lng"); -export const qp_field = queryParam<string>("field"); -export const qp_keynostr = queryParam<string>("key_nostr"); +export const qp_id = queryParam<NavigationRouteParamId>("id"); +export const qp_field = queryParam<NavigationRouteParamField>("field"); +export const qp_ref = queryParam<NavigationRouteParamRef>("ref"); +export const qp_lat = queryParam<NavigationRouteParamLat>("lat"); +export const qp_lng = queryParam<NavigationRouteParamLng>("lng"); +export const qp_keynostr = queryParam<NavigationRouteParamNostrPublicKey>("key_nostr"); export const app_pwa_polyfills = writable<boolean>(false); diff --git a/apps-lib/src/lib/util/lib.ts b/apps-lib/src/lib/util/lib.ts @@ -3,7 +3,7 @@ import { goto } from "$app/navigation"; import { page } from "$app/state"; import { win_h, win_w } from "$root"; import type { ColorMode, ThemeKey } from "@radroots/theme"; -import { encode_qp_route, fmt_geometry_point_coords, fmt_price, parse_currency_marker, type CallbackRoute, type GeometryPoint, type IErrorCatchCallback } from "@radroots/util"; +import { encode_route, fmt_geometry_point_coords, fmt_price, parse_currency_marker, type CallbackRoute, type GeometryPoint, type IErrorCatchCallback } from "@radroots/util"; import { get } from "svelte/store"; export const get_store = get; @@ -48,7 +48,7 @@ export const callback_route = async <T extends string>(callback_route: CallbackR if (`route` in callback_route) { if (typeof callback_route.route === `string`) return void await goto(callback_route.route); else return void await goto( - encode_qp_route( + encode_route( callback_route.route[0], callback_route.route[1], ),