Skip to content

Commit 018a7f4

Browse files
authored
Merge branch 'main' into feature/SeatAnalysis
2 parents 67a113a + c5ccd1d commit 018a7f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/api/GitHubApi.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const getMetricsApi = async (): Promise<Metrics[]> => {
1717
let metricsData;
1818

1919
if (process.env.VUE_APP_MOCKED_DATA === "true") {
20-
20+
console.log("Using mock data. Check VUE_APP_MOCKED_DATA variable.");
2121
if (process.env.VUE_APP_SCOPE === "organization") {
2222
response = organizationMockedResponse;
2323
} else if (process.env.VUE_APP_SCOPE === "enterprise") {
@@ -28,6 +28,10 @@ export const getMetricsApi = async (): Promise<Metrics[]> => {
2828

2929
metricsData = response.map((item: any) => new Metrics(item));
3030
} else {
31+
// if VUE_APP_GITHUB_TOKEN is not set, throw an error
32+
if (!process.env.VUE_APP_GITHUB_TOKEN) {
33+
throw new Error("VUE_APP_GITHUB_TOKEN environment variable is not set.");
34+
}
3135
if (process.env.VUE_APP_SCOPE === "organization") {
3236
response = await axios.get(
3337
`https://api.github.com/orgs/${process.env.VUE_APP_GITHUB_ORG}/copilot/usage`,

src/components/MainComponent.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</v-btn>
77

88
<v-toolbar-title>Copilot Metrics Viewer | {{ capitalizedItemName }} : {{ gitHubOrgName }}</v-toolbar-title>
9-
<h2> </h2>
9+
<h2 class="error-message"> {{ mockedDataMessage }} </h2>
1010
<v-spacer></v-spacer>
1111

1212
<template v-slot:extension>
@@ -84,6 +84,9 @@ export default defineComponent({
8484
},
8585
isScopeOrganization() {
8686
return process.env.VUE_APP_SCOPE === 'organization';
87+
},
88+
mockedDataMessage() {
89+
return process.env.VUE_APP_MOCKED_DATA === 'true' ? 'Using mock data - see README if unintended' : '';
8790
}
8891
},
8992
data () {

0 commit comments

Comments
 (0)