This commit is contained in:
LordMZTE 2020-12-05 22:21:00 +01:00
parent 6e29fb5fcc
commit 9fb5d188a7
3 changed files with 9 additions and 6 deletions

View file

@ -1,5 +1,5 @@
use reqwest::Client;
use anyhow::Result;
use reqwest::Client;
use crate::util;
@ -14,4 +14,4 @@ pub async fn run(http: &Client) -> Result<()> {
println!("{}", table.render());
Ok(())
}
}

View file

@ -1,3 +1,3 @@
pub mod list;
pub mod search;
pub mod up;
pub mod list;

View file

@ -1,4 +1,5 @@
use std::unreachable;
use std::unreachable;
use anyhow::Result;
use once_cell::sync::OnceCell;
@ -39,8 +40,10 @@ pub async fn cats(http: &Client) -> Result<&Vec<String>> {
pub async fn memes(http: &Client) -> Result<&Vec<Meme>> {
if MEMES.get().is_none() {
let res = http.get("https://data.tilera.xyz/api/jensmemes/memes")
.send().await?;
let res = http
.get("https://data.tilera.xyz/api/jensmemes/memes")
.send()
.await?;
let memes = serde_json::from_slice::<MemesResp>(&res.bytes().await?)?;
Ok(MEMES.get_or_init(|| memes.memes))