mirror of
https://github.com/spikecodes/libreddit
synced 2024-12-27 11:06:01 +01:00
Fix User Icons
This commit is contained in:
parent
b1a572072c
commit
4b7cbb3de2
@ -1,5 +1,5 @@
|
||||
// CRATES
|
||||
use crate::utils::{fetch_posts, nested_val, request, ErrorTemplate, Params, Post, User};
|
||||
use crate::utils::{fetch_posts, format_url, nested_val, request, ErrorTemplate, Params, Post, User};
|
||||
use actix_web::{http::StatusCode, web, HttpResponse, Result};
|
||||
use askama::Template;
|
||||
|
||||
@ -65,7 +65,7 @@ async fn user(name: &String) -> Result<User, &'static str> {
|
||||
// Parse the JSON output into a User struct
|
||||
Ok(User {
|
||||
name: name.to_string(),
|
||||
icon: nested_val(&res, "subreddit", "icon_img").await,
|
||||
icon: format_url(nested_val(&res, "subreddit", "icon_img").await.as_str()).await,
|
||||
karma: res["data"]["total_karma"].as_i64().unwrap(),
|
||||
banner: nested_val(&res, "subreddit", "banner_img").await,
|
||||
description: nested_val(&res, "subreddit", "public_description").await,
|
||||
|
Loading…
Reference in New Issue
Block a user