From cb19925011d889c513e1bbedc446e399597e38a0 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Wed, 17 Apr 2024 14:06:05 +0100 Subject: feat(gui): work on home page, sort state (#1956) 1. Start on a home page, can sort onboarding/etc from there 2. Introduce zustand for state management. It's nice! Did a production build and clicked around for a while. Memory usage seems nice and chill. --- atuin-client/src/api_client.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'atuin-client/src/api_client.rs') diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs index a19e5305..f31a796e 100644 --- a/atuin-client/src/api_client.rs +++ b/atuin-client/src/api_client.rs @@ -11,7 +11,7 @@ use reqwest::{ use atuin_common::{ api::{ AddHistoryRequest, ChangePasswordRequest, CountResponse, DeleteHistoryRequest, - ErrorResponse, LoginRequest, LoginResponse, RegisterResponse, StatusResponse, + ErrorResponse, LoginRequest, LoginResponse, MeResponse, RegisterResponse, StatusResponse, SyncHistoryResponse, }, record::RecordStatus, @@ -234,6 +234,18 @@ impl<'a> Client<'a> { Ok(status) } + pub async fn me(&self) -> Result { + let url = format!("{}/api/v0/me", self.sync_addr); + let url = Url::parse(url.as_str())?; + + let resp = self.client.get(url).send().await?; + let resp = handle_resp_error(resp).await?; + + let status = resp.json::().await?; + + Ok(status) + } + pub async fn get_history( &self, sync_ts: OffsetDateTime, -- cgit v1.3.1