File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export const getMetricsApi = async (): Promise<Metrics[]> => {
17
17
let metricsData ;
18
18
19
19
if ( process . env . VUE_APP_MOCKED_DATA === "true" ) {
20
-
20
+ console . log ( "Using mock data. Check VUE_APP_MOCKED_DATA variable." ) ;
21
21
if ( process . env . VUE_APP_SCOPE === "organization" ) {
22
22
response = organizationMockedResponse ;
23
23
} else if ( process . env . VUE_APP_SCOPE === "enterprise" ) {
@@ -28,6 +28,10 @@ export const getMetricsApi = async (): Promise<Metrics[]> => {
28
28
29
29
metricsData = response . map ( ( item : any ) => new Metrics ( item ) ) ;
30
30
} 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
+ }
31
35
if ( process . env . VUE_APP_SCOPE === "organization" ) {
32
36
response = await axios . get (
33
37
`https://api.github.com/orgs/${ process . env . VUE_APP_GITHUB_ORG } /copilot/usage` ,
Original file line number Diff line number Diff line change 6
6
</v-btn >
7
7
8
8
<v-toolbar-title >Copilot Metrics Viewer | {{ capitalizedItemName }} : {{ gitHubOrgName }}</v-toolbar-title >
9
- <h2 > </h2 >
9
+ <h2 class = " error-message " > {{ mockedDataMessage }} </h2 >
10
10
<v-spacer ></v-spacer >
11
11
12
12
<template v-slot :extension >
@@ -74,6 +74,9 @@ export default defineComponent({
74
74
},
75
75
capitalizedItemName() {
76
76
return this .itemName .charAt (0 ).toUpperCase () + this .itemName .slice (1 );
77
+ },
78
+ mockedDataMessage() {
79
+ return process .env .VUE_APP_MOCKED_DATA === ' true' ? ' Using mock data - see README if unintended' : ' ' ;
77
80
}
78
81
},
79
82
data () {
You can’t perform that action at this time.
0 commit comments