Skip to content

Commit

Permalink
feat(qsync): undefined query string values
Browse files Browse the repository at this point in the history
  • Loading branch information
Wulf committed Jan 15, 2024
1 parent 107cd04 commit e8fe1e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions create-rust-app_cli/qsync/src/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ impl Hook {
}

if !self.query_params.is_empty() {
variables.push_str(" const queryParams: Record<string, any> = Object.assign({}, ");
variables.push_str(
" // we use JSON.parse(JSON.stringify()) to remove nested undefined values\n",
);
variables.push_str(" const queryParams: Record<string, any> = JSON.parse(JSON.stringify(Object.assign({}, ");
let query_param_iter = self.query_params.iter();
for (index, param) in query_param_iter.clone().enumerate() {
let is_primitive_type = is_primitive_type(param.hook_arg_type.clone());
Expand All @@ -126,7 +129,7 @@ impl Hook {
variables.push_str(", ");
}
}
variables.push_str(")\n");
variables.push_str(")))\n");
}

if !self.path_params.is_empty() {
Expand Down

0 comments on commit e8fe1e7

Please sign in to comment.