mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-09 06:47:59 -06:00
Make config window into config browser
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use egui::{Align2, Area, Color32, Frame, Order, Sense, UiKind, Vec2, mutex::Mutex};
|
||||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde_json::json;
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
use std::sync::Arc;
|
||||
use wasm_bindgen::prelude::Closure;
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
@@ -152,7 +152,7 @@ impl Auth {
|
||||
|
||||
pub fn get<T, F>(&self, path: &str, ret: F)
|
||||
where
|
||||
F: FnOnce(Result<T, String>) + 'static,
|
||||
F: FnOnce(T) + 'static,
|
||||
T: DeserializeOwned,
|
||||
{
|
||||
if let Some(ref token) = self.token {
|
||||
@@ -163,7 +163,7 @@ impl Auth {
|
||||
Closure::once_into_js(move |ok: bool, response: String| {
|
||||
if ok {
|
||||
crate::log(&response);
|
||||
if let Ok(value) = serde_json::from_str::<Result<T, String>>(&response) {
|
||||
if let Ok(value) = serde_json::from_str::<T>(&response) {
|
||||
ret(value)
|
||||
} else {
|
||||
*(state.lock()) = AuthState::Error("Malformed Response".into());
|
||||
|
||||
Reference in New Issue
Block a user