Skip to content

Commit

Permalink
Merge pull request #3127 from CVEProject/tat-3123-record
Browse files Browse the repository at this point in the history
#3123 temp support of two different cve services environments
  • Loading branch information
athu-tran authored Oct 1, 2024
2 parents b18c1fa + 3434d42 commit d33ac99
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/stores/cveRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const usecveRecordStore = defineStore('cveRecord', {
submenu: {}
},
orgIdAndLongNameMap: {},
cveProgramShortName: 'cve'
cveProgramShortName: 'cve',
cveServicesBaseUrl: 'https://cveawg.mitre.org'
}
},
actions: {
Expand Down
4 changes: 2 additions & 2 deletions src/views/CVERecord/CVERecord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default {
const getIdUrl = `/api/cve-id/${usecveRecordStore().cveId}`;
try {
// axios.defaults.baseURL = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}`;
axios.defaults.baseURL = "https://cveawg.mitre.org";
axios.defaults.baseURL = usecveRecordStore().cveServicesBaseUrl;
const idData = await axios.get(getIdUrl);
this.getIdStatusCode = 200;
if (idData.status === 200 && idData?.data?.error === undefined) {
Expand Down Expand Up @@ -245,7 +245,7 @@ export default {
},
async getRecordData() {
// const getRecordUrl = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}/api/cve/${usecveRecordStore().cveId}`;
const getRecordUrl = `https://cveawg.mitre.org/api/cve/${usecveRecordStore().cveId}`;
const getRecordUrl = `${usecveRecordStore().cveServicesBaseUrl}/api/cve/${usecveRecordStore().cveId}`;
const recordData = await axios.get(getRecordUrl);
if (!(typeof (recordData.data) === 'object')) {
Expand Down
9 changes: 9 additions & 0 deletions src/views/CVERecord/SearchResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<div class="columns cve-columns">
<div class="column cve-column">
<router-link :to="`/CVERecord?id=${cveListSearchStore.recordData.cveId}`" target="_blank">{{ cveListSearchStore.recordData.cveId }}</router-link>
<button @click="getTestRecordTemp" class="button is-small cve-button temp">
Get Test Record
</button>
</div>
<div class="column cve-column">
<p><span>CNA: </span>{{ usePartnerStore?.[cveListSearchStore.recordData.cna] || cveListSearchStore.recordData.cna }}</p>
Expand Down Expand Up @@ -251,6 +254,12 @@ function backToTop() {
replace: true
});
}
// Temp
function getTestRecordTemp() {
usecveRecordStore().cveServicesBaseUrl = 'https://cveawg-test.mitre.org';
this.$router.push(`/CVERecord?id=${cveListSearchStore.recordData.cveId}`);
}
</script>

<style lang="scss">
Expand Down

0 comments on commit d33ac99

Please sign in to comment.