File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,11 @@ impl HomePage {
246246 }
247247
248248 fn fetch_has_new ( & mut self ) {
249+ if get_data ( ) . config . offline_mode || get_data ( ) . me . is_none ( ) || get_data ( ) . tokens . is_none ( ) {
250+ self . has_new_task = None ;
251+ self . has_new = false ;
252+ return ;
253+ }
249254 let time = get_data ( ) . message_check_time . unwrap_or_default ( ) ;
250255 self . has_new_task = Some ( Task :: new ( async move {
251256 #[ derive( Deserialize ) ]
@@ -453,8 +458,12 @@ impl Page for HomePage {
453458 if self . char_last_user_id != current_user {
454459 let locale = get_data ( ) . language . clone ( ) . unwrap_or ( LANG_IDENTS [ 0 ] . to_string ( ) ) ;
455460 self . char_last_user_id = current_user;
456- self . char_fetch_task =
457- Some ( Task :: new ( async move { Ok ( recv_raw ( Client :: get ( "/me/char" ) . query ( & [ ( "locale" , locale) ] ) ) . await ?. json ( ) . await ?) } ) ) ;
461+ if get_data ( ) . config . offline_mode || get_data ( ) . me . is_none ( ) || get_data ( ) . tokens . is_none ( ) {
462+ self . char_fetch_task = None ;
463+ } else {
464+ self . char_fetch_task =
465+ Some ( Task :: new ( async move { Ok ( recv_raw ( Client :: get ( "/me/char" ) . query ( & [ ( "locale" , locale) ] ) ) . await ?. json ( ) . await ?) } ) ) ;
466+ }
458467 }
459468 if let Some ( task) = & mut self . update_task {
460469 if let Some ( res) = task. take ( ) {
You can’t perform that action at this time.
0 commit comments