Moved modal state into global state
All checks were successful
Build Crate / build (push) Successful in 1m39s

unfortunate but easiest way
This commit is contained in:
2024-08-25 16:36:13 -04:00
parent 462ca81a15
commit 99b4d9af1a
3 changed files with 43 additions and 40 deletions

View File

@@ -3,7 +3,7 @@
use perseus::{prelude::*, state::GlobalStateCreator};
use serde::{Deserialize, Serialize};
use crate::state_enums::LoginState;
use crate::state_enums::{LoginState, OpenState};
cfg_if::cfg_if! {
if #[cfg(engine)] {
@@ -16,6 +16,8 @@ cfg_if::cfg_if! {
pub struct AppState {
#[rx(nested)]
pub auth: AuthData,
#[rx(nested)]
pub modals_open: ModalOpenData,
}
#[derive(Serialize, Deserialize, ReactiveState, Clone)]
@@ -26,6 +28,12 @@ pub struct AuthData {
pub claims: Claims,
}
#[derive(Serialize, Deserialize, ReactiveState, Clone)]
#[rx(alias = "ModalOpenDataRx")]
pub struct ModalOpenData {
pub login: OpenState,
}
#[derive(Serialize, Deserialize, ReactiveState, Clone)]
#[rx(alias = "ClaimsRx")]
pub struct Claims {}
@@ -42,6 +50,9 @@ pub async fn get_build_state() -> AppState {
username: None,
claims: Claims {},
},
modals_open: ModalOpenData {
login: OpenState::Closed,
},
}
}