Fix User Icons
This commit is contained in:
parent
b1a572072c
commit
4b7cbb3de2
@ -1,5 +1,5 @@
|
|||||||
// CRATES
|
// 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 actix_web::{http::StatusCode, web, HttpResponse, Result};
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ async fn user(name: &String) -> Result<User, &'static str> {
|
|||||||
// Parse the JSON output into a User struct
|
// Parse the JSON output into a User struct
|
||||||
Ok(User {
|
Ok(User {
|
||||||
name: name.to_string(),
|
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(),
|
karma: res["data"]["total_karma"].as_i64().unwrap(),
|
||||||
banner: nested_val(&res, "subreddit", "banner_img").await,
|
banner: nested_val(&res, "subreddit", "banner_img").await,
|
||||||
description: nested_val(&res, "subreddit", "public_description").await,
|
description: nested_val(&res, "subreddit", "public_description").await,
|
||||||
|
Loading…
Reference in New Issue
Block a user