@@ -60,8 +60,7 @@ export default {
6060 return {
6161 cveRecordsTotal: 0 ,
6262 cveRecordsLoading: true ,
63- cveRecordsRequestErrored: false ,
64- legacyCveWebsiteLink: this .GenericGlobalsStore .legacyCveWebsiteLink
63+ cveRecordsRequestErrored: false
6564 }
6665 },
6766 created () {
@@ -75,24 +74,23 @@ export default {
7574 },
7675 methods: {
7776 getCVERecordsCount () {
77+ const countUrl = ` ${ this .GenericGlobalsStore .cveServiceTestBaseUrl } /api/cve_count` ;
78+
7879 axios
79- .get (` ${ import .meta.env.VITE_API_BASE_URL}cve-count.json ` , { timeout: 30000 } )
80+ .get (countUrl )
8081 .then ((res ) => {
81- let count = parseInt(res.data.count, 10);
8282
83- if ((typeof count === 'number') && !Number.isNaN(count)) {
84- this.cveRecordsRequestErrored = false;
83+ // The API returns the record count as a Number value (not a string).
8584
86- // As of March 2025, we’re reporting the CVE Record count rounded
87- // to the next lowest thousand, and reporting it as "over xxx"
88- // thousand records (a la McDonald's), instead of the actual count.
85+ let count = res .data .totalCount ;
8986
90- count = Math.floor(count / 1000) * 1000;
91- this.cveRecordsTotal = count.toString().replace(/\B (?=(\d {3})+(?!\d ))/g, ',');
92- } else {
93- this.cveRecordsRequestErrored = true;
94- }
95- })
87+ // As of March 2025, we're reporting the CVE record count rounded
88+ // to the next lowest thousand, and reporting it as "over xxx"
89+ // thousand records (a la McDonald's), instead of the actual count.
90+
91+ count = Math .floor (count / 1000 ) * 1000 ;
92+ this .cveRecordsTotal = count .toString ().replace (/ \B (?=(\d {3} )+ (?!\d ))/ g , ' ,' );
93+ })
9694 .catch (() => {
9795 this .cveRecordsRequestErrored = true ;
9896 })
0 commit comments