feat: user usage
This commit is contained in:
parent
af32cd62d0
commit
f7a8cdcd65
|
|
@ -30,7 +30,7 @@ pub async fn get_user_workspace_limit(
|
|||
let res = resp.json::<JsonResponse<UserUsageLimit>>().await?;
|
||||
let b = res.data;
|
||||
let c = b.workspace_count.unwrap_or({
|
||||
tracing::warn!("workspace_count is None, return 0");
|
||||
tracing::warn!("workspace_count is None, returning 0");
|
||||
0
|
||||
});
|
||||
Ok(c as u32)
|
||||
|
|
|
|||
|
|
@ -90,8 +90,6 @@ pub async fn admin_navigate_handler() -> Result<Html<String>, WebAppError> {
|
|||
}
|
||||
|
||||
pub async fn user_invite_handler() -> Result<Html<String>, WebAppError> {
|
||||
println!("----- user_invite_handler");
|
||||
|
||||
render_template(templates::Invite)
|
||||
}
|
||||
|
||||
|
|
@ -99,8 +97,6 @@ pub async fn user_usage_handler(
|
|||
State(state): State<AppState>,
|
||||
session: UserSession,
|
||||
) -> Result<Html<String>, WebAppError> {
|
||||
println!("----- user_usage_handler");
|
||||
|
||||
let workspace_count =
|
||||
get_user_workspace_count(&session.token.access_token, &state.appflowy_cloud_url)
|
||||
.await
|
||||
|
|
@ -113,16 +109,16 @@ pub async fn user_usage_handler(
|
|||
&session.token.access_token,
|
||||
&state.appflowy_cloud_gateway_url,
|
||||
)
|
||||
.await;
|
||||
println!("workspace count: {:?}", workspace_count);
|
||||
.await
|
||||
.unwrap_or_else(|err| {
|
||||
tracing::error!("Error getting user workspace limit: {:?}", err);
|
||||
0
|
||||
});
|
||||
|
||||
render_template(templates::Invite)
|
||||
|
||||
// todo!();
|
||||
// render_template(templates::UserUsage {
|
||||
// workspace_count: 500,
|
||||
// workspace_limit: 1000,
|
||||
// })
|
||||
render_template(templates::UserUsage {
|
||||
workspace_count,
|
||||
workspace_limit,
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn workspace_usage_handler(session: UserSession) -> Result<Html<String>, WebAppError> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue