Skip to content

Commit

Permalink
fix query params
Browse files Browse the repository at this point in the history
  • Loading branch information
dmmulroy committed Mar 12, 2024
1 parent 4b2c5ee commit 05a0cf0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/glitch/api/user.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ pub type GetUsersRequest {
pub fn query_params_from_get_users_request(
req: GetUsersRequest,
) -> Option(List(#(String, String))) {
let to_query_param_list = fn(list: Option(List(String))) -> List(
let to_query_param_list = fn(input: #(String, Option(List(String)))) -> List(
#(String, String),
) {
list
input.1
|> option.map(fn(values) {
values
|> list.map(fn(value) { #("user_id", value) })
|> list.map(fn(value) { #(input.0, value) })
})
|> option.unwrap([])
}

[req.user_ids, req.user_logins]
[#("id", req.user_ids), #("login", req.user_logins)]
|> list.map(to_query_param_list)
|> list.flatten
|> fn(list) {
Expand Down

0 comments on commit 05a0cf0

Please sign in to comment.