forked from trent_larson/crowd-funder-for-time-pwa
fix: Fix error with deep links trying to parse empty query parameters.
This commit is contained in:
@@ -33,7 +33,6 @@ export const deepLinkSchemas = {
|
||||
id: z.string(),
|
||||
}),
|
||||
"claim-add-raw": z.object({
|
||||
id: z.string(),
|
||||
claim: z.string().optional(),
|
||||
claimJwtId: z.string().optional(),
|
||||
}),
|
||||
|
||||
@@ -201,10 +201,9 @@ export class DeepLinkHandler {
|
||||
// Continue with parameter validation as before...
|
||||
const schema = deepLinkSchemas[path as keyof typeof deepLinkSchemas];
|
||||
|
||||
let validatedParams, validatedQuery;
|
||||
let validatedParams;
|
||||
try {
|
||||
validatedParams = await schema.parseAsync(params);
|
||||
validatedQuery = await schema.parseAsync(query);
|
||||
} catch (error) {
|
||||
// For parameter validation errors, provide specific error feedback
|
||||
logConsoleAndDb(
|
||||
@@ -230,11 +229,10 @@ export class DeepLinkHandler {
|
||||
await this.router.replace({
|
||||
name: routeName,
|
||||
params: validatedParams,
|
||||
query: validatedQuery,
|
||||
});
|
||||
} catch (error) {
|
||||
logConsoleAndDb(
|
||||
`[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)} ... and validated query: ${JSON.stringify(validatedQuery)}`,
|
||||
`[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)}`,
|
||||
true,
|
||||
);
|
||||
// For parameter validation errors, provide specific error feedback
|
||||
@@ -245,7 +243,6 @@ export class DeepLinkHandler {
|
||||
originalPath: path,
|
||||
errorCode: "ROUTING_ERROR",
|
||||
errorMessage: `Error routing to ${routeName}: ${JSON.stringify(error)}`,
|
||||
...validatedQuery,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user