mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-17 19:35:38 +00:00
make all frontend functions works (#466)
This commit is contained in:
@@ -22,6 +22,10 @@ pub struct LoginResult {
|
||||
pub fn router() -> Router<AppStateInner> {
|
||||
let r = Router::new()
|
||||
.route("/api/v1/auth/password", put(self::put::change_password))
|
||||
.route(
|
||||
"/api/v1/auth/check_login_status",
|
||||
get(self::get::check_login_status),
|
||||
)
|
||||
.route_layer(login_required!(Backend));
|
||||
Router::new()
|
||||
.merge(r)
|
||||
@@ -168,4 +172,17 @@ mod get {
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn check_login_status(
|
||||
auth_session: AuthSession,
|
||||
) -> Result<Json<Void>, HttpHandleError> {
|
||||
if auth_session.user.is_some() {
|
||||
Ok(Json(Void::default()))
|
||||
} else {
|
||||
Err((
|
||||
StatusCode::UNAUTHORIZED,
|
||||
Json::from(other_error("Not logged in")),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user