Skip to content

Commit

Permalink
Fix linter errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoquick committed Jun 29, 2022
1 parent c9dcc21 commit 76e83c9
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use serde::Serialize;
#[macro_export]
macro_rules! log {
($($arg:expr),+) => {
let output = vec![$(String::from($arg),)+].join(" ");
#[cfg(target_arch = "wasm32")]
gloo_console::log!([$($arg,)+]);
gloo_console::log!(format!("{}", output));
#[cfg(not(target_arch = "wasm32"))]
log::info!("{}", vec![$(String::from($arg),)+].join(" "));
log::info!("{}", output);
};
}

Expand All @@ -36,16 +37,11 @@ pub async fn post_json<T: Serialize>(url: String, body: &T) -> Result<(String, u
}

#[cfg(target_arch = "wasm32")]
pub async fn post_json<T: Serialize>(url: String, body: &T) -> Result<(String, u16)> {
let response = Request::post(&url)
.body(serde_json::to_string(body)?)
.header(
"Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8",
)
pub async fn get(url: String) -> Result<(String, u16)> {
let response = Request::get(&url)
.send()
.await
.context(format!("Error sending JSON POST request to {}", url))?;
.context(format!("Error sending GET request to {}", url))?;

let status_code = response.status();

Expand Down

0 comments on commit 76e83c9

Please sign in to comment.