Start a a new UI framework, providing both a login page and a landing page. #299

Merged
savanni merged 30 commits from visions-ui-framework into main 2025-03-28 13:11:04 +00:00
2 changed files with 48 additions and 6 deletions
Showing only changes of commit 1c4894df9a - Show all commits
visions/ui/src

39
visions/ui/src/client.rs Normal file
View File

@ -0,0 +1,39 @@
use gloo_net::http::Request;
use serde::Deserialize;
#[derive(Deserialize)]
enum AuthResponse {
Ok(SessionId),
PasswordReset(SessionId),
}
#[derive(Deserialize)]
struct SessionId(String);
enum ClientError {
Unauthorized,
}
#[derive(Deserialize)]
struct UserId(String);
#[derive(Deserialize)]
struct UserInfo {
id: UserId,
name: String,
}
trait Client {
async fn auth(username: String, password: String) -> Result<AuthResponse, ClientError>;
async fn list_users(session_id: SessionId) -> Result<Vec<UserInfo>, ClientError>;
}
impl Client for Connection {
async fn auth(username: String, password: String) -> Result<AuthResponse, ClientError> {
let request = Request::post("http://localhost:8001")
.body().unwrap();
}
async fn list_users(session_id: SessionId) -> Result<Vec<UserInfo>, ClientError> {
}
}

View File

@ -2,6 +2,9 @@ use std::rc::Rc;
use yew::prelude::*;
mod client;
pub use client::*;
struct AuthInfo {
session_id: Option<String>,
}