inertia_rust/temporary_session.rs
1use serde::Serialize;
2use serde_json::{Map, Value};
3
4/// `InertiaTemporarySession` struct contains data that InertiaMiddleware will try to extract
5/// from the request and merge with shared props.
6///
7/// You must inject it by yourself by a second middleware, which gets these information from
8/// your framework sessions manager.
9#[derive(Clone, Serialize, Debug)]
10pub struct InertiaTemporarySession {
11 pub errors: Option<Map<String, Value>>,
12 pub prev_req_url: String,
13}
14
15impl Default for InertiaTemporarySession {
16 fn default() -> Self {
17 InertiaTemporarySession {
18 errors: None,
19 prev_req_url: "/".to_string(),
20 }
21 }
22}
23
24pub struct InertiaSessionToReflash(pub InertiaTemporarySession);