Skip to content

Commit

Permalink
feat: use correct API server when in prod
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <hivert.is.coming@gmail.com>
  • Loading branch information
ghivert committed May 14, 2024
1 parent 2bfe747 commit 4a68051
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/frontend/src/frontend.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ fn reset(model: Model) {
}

fn submit_search(model: Model) {
let endpoint = case is_dev() {
True -> "http://localhost:3000"
False -> "https://api.gloogle.run"
}
use <- bool.guard(when: model.input == "", return: #(model, effect.none()))
http.expect_json(search_result.decode_search_results, msg.SearchResults)
|> http.get("http://localhost:3000/search?q=" <> model.input, _)
|> http.get(endpoint <> "/search?q=" <> model.input, _)
|> pair.new(model, _)
}

Expand Down

0 comments on commit 4a68051

Please sign in to comment.