Skip to content

Commit

Permalink
feat(ui): save server field
Browse files Browse the repository at this point in the history
  • Loading branch information
DefectingCat committed Jan 13, 2025
1 parent 3b1c9f0 commit abc6175
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion venus-ui/src/components/home_page/subscripiton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn add_subscription(subs_form: SubCardForm) -> Result<BaseResponse<()>, St
/// 首页中的订阅选项卡
#[component]
pub fn Subscription() -> impl IntoView {
let (form, set_form) = create_signal(SubCardForm {
let (form, set_form) = signal(SubCardForm {
name: "".into(),
url: "".into(),
});
Expand Down
1 change: 1 addition & 0 deletions venus-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl Notification {
/// 登录后保存的用户信息
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct User {
pub server: String,
pub username: String,
/// 用户的 jwt token
/// 决定了用户是否已经登录
Expand Down
1 change: 1 addition & 0 deletions venus-ui/src/pages/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pub fn Login() -> impl IntoView {
));
});
let user = User {
server: form().server.clone(),
username: form().username.clone(),
token: data.access_token.clone(),
token_type: data.token_type.clone(),
Expand Down
4 changes: 3 additions & 1 deletion venus/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ pub enum AppError {
InvalidHeaderValue(#[from] header::InvalidHeaderValue),
#[error(transparent)]
ValidationError(#[from] validator::ValidationErrors),

// axum
#[error(transparent)]
AxumFormRejection(#[from] FormRejection),
#[error(transparent)]
AxumJsonRejection(#[from] JsonRejection),

// jwt
#[error(transparent)]
Jwt(#[from] jsonwebtoken::errors::Error),
Expand Down Expand Up @@ -136,8 +138,8 @@ impl IntoResponse for AppError {
"Invalid token".to_string(),
),
},
AppError::VenusGrpc(grpc_error) => todo!(),
// core
AppError::VenusGrpc(err) => log_internal_error(err),
};
let body = Json(json!({
"code": code,
Expand Down

0 comments on commit abc6175

Please sign in to comment.