Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Commit 5bc4ca9

Browse files
committed
updated with workaround to get repo by id
1 parent 063ebbd commit 5bc4ca9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.gov/api-client",
3-
"version": "0.2.8",
3+
"version": "0.2.9",
44
"description": "Client for Interacting with Code.gov API",
55
"main": "dist/bundle.js",
66
"scripts": {

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ class CodeGovAPIClient {
144144
getRepoById(repoId = '') {
145145
let url = `${this.base}repos/${repoId}`
146146
if (this.api_key) url += `?api_key=${this.api_key}`
147-
return get(url).then(response => response.data)
147+
return get(url).then(response => {
148+
const { data } = response
149+
// if the response is returned as an array
150+
if (some(data)) {
151+
return data[0]
152+
} else {
153+
return data
154+
}
155+
})
148156
}
149157

150158
/**

0 commit comments

Comments
 (0)