@@ -66,20 +66,34 @@ export const useThemeStore = defineStore('theme', () => {
6666    if  ( data )  { 
6767      theme . value  =  data ; 
6868    }  else  { 
69-       const   result   =   await   load ( ) ; 
70-       if   ( result )   { 
71-         if  ( result . publicTheme )  { 
69+       try   { 
70+          const   result   =   await   load ( ) ; 
71+         if  ( result   &&   result . publicTheme )  { 
7272          theme . value  =  { 
73-             name : result . publicTheme . name . toLowerCase ( ) , 
74-             banner : result . publicTheme . showBannerImage , 
75-             bannerGradient : result . publicTheme . showBannerGradient , 
76-             bgColor : result . publicTheme . headerBackgroundColor , 
77-             descriptionShow : result . publicTheme . showHeaderDescription , 
73+             name : result . publicTheme . name ? .toLowerCase ( )   ||   'white' , 
74+             banner : result . publicTheme . showBannerImage   ??   false , 
75+             bannerGradient : result . publicTheme . showBannerGradient   ??   false , 
76+             bgColor : result . publicTheme . headerBackgroundColor   ||   '' , 
77+             descriptionShow : result . publicTheme . showHeaderDescription   ??   false , 
7878            metaColor : result . publicTheme . headerSecondaryTextColor  ||  '' , 
79-             textColor : result . publicTheme . headerPrimaryTextColor , 
79+             textColor : result . publicTheme . headerPrimaryTextColor   ||   '' , 
8080          } ; 
81+           return ; 
8182        } 
83+       }  catch  ( error )  { 
84+         console . warn ( 'Failed to load theme from server, using default:' ,  error ) ; 
8285      } 
86+       
87+       // Single fallback for both no data and error cases 
88+       theme . value  =  { 
89+         name : 'white' , 
90+         banner : false , 
91+         bannerGradient : false , 
92+         bgColor : '' , 
93+         descriptionShow : false , 
94+         metaColor : '' , 
95+         textColor : '' , 
96+       } ; 
8397    } 
8498  } ; 
8599
0 commit comments