@@ -6,7 +6,6 @@ mod state;
66pub use state:: AuthState ;
77
88use crate :: fetch:: Fetcher ;
9- #[ cfg( all( feature = "fullstack-server" , feature = "server" ) ) ]
109use dioxus:: prelude:: * ;
1110#[ cfg( all( feature = "fullstack-server" , feature = "server" ) ) ]
1211use jacquard:: oauth:: types:: OAuthClientMetadata ;
@@ -26,12 +25,18 @@ pub async fn client_metadata() -> Result<axum::Json<serde_json::Value>> {
2625}
2726
2827#[ cfg( not( target_arch = "wasm32" ) ) ]
29- pub async fn restore_session ( _fetcher : Fetcher ) -> Result < ( ) , String > {
28+ pub async fn restore_session (
29+ _fetcher : Fetcher ,
30+ _auth_state : Signal < AuthState > ,
31+ ) -> Result < ( ) , String > {
3032 Ok ( ( ) )
3133}
3234
3335#[ cfg( target_arch = "wasm32" ) ]
34- pub async fn restore_session ( fetcher : Fetcher ) -> Result < ( ) , CapturedError > {
36+ pub async fn restore_session (
37+ fetcher : Fetcher ,
38+ mut auth_state : Signal < AuthState > ,
39+ ) -> Result < ( ) , CapturedError > {
3540 use dioxus:: prelude:: * ;
3641 use gloo_storage:: { LocalStorage , Storage } ;
3742 use jacquard:: types:: string:: Did ;
@@ -70,8 +75,6 @@ pub async fn restore_session(fetcher: Fetcher) -> Result<(), CapturedError> {
7075 let ( restored_did, session_id) = session. session_info ( ) . await ;
7176
7277 // Update auth state
73- let mut auth_state = try_consume_context :: < Signal < AuthState > > ( )
74- . ok_or ( CapturedError :: from_display ( "AuthState not in context" ) ) ?;
7578 auth_state
7679 . write ( )
7780 . set_authenticated ( restored_did, session_id) ;
0 commit comments