You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
632 B
27 lines
632 B
use crate::{
|
|
api::types::{paginated_response::PaginatedResponse, transaction::TransactionCompany},
|
|
env::Config,
|
|
};
|
|
|
|
pub async fn get_transactions(
|
|
company_slug: Option<String>,
|
|
page: i64,
|
|
size: i64,
|
|
) -> Result<PaginatedResponse<TransactionCompany>, ()> {
|
|
let res = reqwasm::http::Request::get(&format!(
|
|
"{}transaction{}?page={}&size={}",
|
|
Config::new().api_url,
|
|
company_slug.unwrap_or("".to_string()),
|
|
page,
|
|
size,
|
|
))
|
|
.send()
|
|
.await
|
|
.map_err(|_| ())?
|
|
.json::<PaginatedResponse<TransactionCompany>>()
|
|
.await
|
|
.map_err(|_| ())?;
|
|
|
|
Ok(res)
|
|
}
|