@@ -75,7 +75,8 @@ enum Msg {
7575 ConfigFetched ( fetch:: Result < Config > ) ,
7676 GetAccount ,
7777 GetAccountSuccess ( Data < Accounts > ) ,
78-
78+ GetMeDetails ,
79+ GetMeDetailsSuccess ( Me ) ,
7980 AccessTokenInformation ,
8081 AccessTokenInfoData ( AccessTokenInformation ) ,
8182
@@ -95,6 +96,7 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
9596 Msg :: ConfigFetched ( Err ( fetch_error) ) => error ! ( "Config fetch failed! Be sure to have config.json at the root of your project with client_id and redirect_uri" , fetch_error) ,
9697
9798 Msg :: GetAccount => {
99+ orders. send_msg ( Msg :: GetMeDetails ) ;
98100 if let Some ( user_access_tokens) = model. user_tokens . clone ( ) {
99101 let user_tokens = user_access_tokens;
100102 let client = Client :: new ( user_tokens, "" . to_string ( ) ) ;
@@ -111,6 +113,26 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
111113 }
112114 }
113115
116+ Msg :: GetMeDetails => {
117+ if let Some ( user_access_tokens) = model. user_tokens . clone ( ) {
118+ let user_tokens = user_access_tokens;
119+ let user_token = user_tokens. long_lived_token . clone ( ) ;
120+ let client = Client :: new ( user_tokens, "" . to_string ( ) ) ;
121+ orders. perform_cmd ( async {
122+ // we are interested in the page long live token, therefore we called the long
123+ // live methed by passing "long_live_token" to the method
124+ client
125+ . me_by_short_or_long_live_token ( "short_live" . to_string ( ) )
126+ . details ( )
127+ . await
128+ . map_or_else ( Msg :: ResponseFailed , Msg :: GetMeDetailsSuccess )
129+ } ) ;
130+ }
131+ }
132+ Msg :: GetMeDetailsSuccess ( resp) => {
133+
134+ }
135+
114136 Msg :: GetAccountSuccess ( accounts) => {
115137 model. accounts = Some ( accounts. clone ( ) ) ;
116138 model. facebook . accounts = Some ( accounts. clone ( ) ) ;
0 commit comments