Home: fix the crash if no profile exists
This commit is contained in:
		
							parent
							
								
									35f51db294
								
							
						
					
					
						commit
						5c150a6aa3
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -198,8 +198,16 @@ const Home: ParentComponent = (props) => {
 | 
				
			||||||
  const settings$ = useStore($settings);
 | 
					  const settings$ = useStore($settings);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [profiles] = useSignedInProfiles();
 | 
					  const [profiles] = useSignedInProfiles();
 | 
				
			||||||
  const profile = () => profiles()[0].inf;
 | 
					  const profile = () => {
 | 
				
			||||||
  const client = () => profiles()[0].client;
 | 
					    const all = profiles();
 | 
				
			||||||
 | 
					    if (all.length > 0) {
 | 
				
			||||||
 | 
					      return all[0].inf;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  const client = () => {
 | 
				
			||||||
 | 
					    const all = profiles()
 | 
				
			||||||
 | 
					    return all?.[0]?.client
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
  const navigate = useNavigate();
 | 
					  const navigate = useNavigate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [heroSrc, setHeroSrc] = createSignal<HeroSource>({});
 | 
					  const [heroSrc, setHeroSrc] = createSignal<HeroSource>({});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue