This is an automated email from the ASF dual-hosted git repository.

luzhijing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new b1f0a3ba849 [fix] fix get github star api error (#392)
b1f0a3ba849 is described below

commit b1f0a3ba849c21c099dd18181c47f17c9e6fbe11
Author: velodb-Linjiang <[email protected]>
AuthorDate: Mon Jan 15 16:24:47 2024 +0800

    [fix] fix get github star api error (#392)
    
    Co-authored-by: jeffrey <[email protected]>
---
 src/theme/Navbar/Content/index.tsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/theme/Navbar/Content/index.tsx 
b/src/theme/Navbar/Content/index.tsx
index 80c173c0951..05af4ea7c83 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -64,8 +64,10 @@ export default function NavbarContent({ mobile }) {
     async function getGithubStar() {
         const res = await fetch('https://api.github.com/repos/apache/doris');
         const data = await res.json();
-        const starStr = 
(+parseFloat(formatStar(data.stargazers_count)).toFixed(1)).toString();
-        setStar(starStr);
+        if (data && data.stargazers_count) {
+            const starStr = 
(+parseFloat(formatStar(data.stargazers_count)).toFixed(1)).toString();
+            setStar(starStr);
+        }
     }
 
     function formatStar(star) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to